implements serializable中文翻譯,implements serializable是什么意思,implements serializable發(fā)音、用法及例句
1、implements serializable
implements serializable發(fā)音
英: 美:
implements serializable中文意思翻譯
常見(jiàn)釋義:
實(shí)現可序列化
implements serializable雙語(yǔ)使用場(chǎng)景
1、If you want the class to be serializable, you'll need to test it, just as you would test a class that directly implements Serializable.───若您希望類(lèi)可串行化,就需要測試它,這與您需要測試一個(gè)直接實(shí)現了Serializable的類(lèi)相同。
2、Yes, if the super class implements serializable, then so do the sub classes.───是的,如果超類(lèi)實(shí)現 序列化,那么子類(lèi)。
3、Even if a class implements Serializable, there's no guarantee that it can be serialized.───是的,如果超類(lèi)實(shí)現序列化,那么子類(lèi)。
4、Even if a class implements Serializable, there's no guarantee that it can be serialized.───即使一個(gè)類(lèi)實(shí)現了Serializable,依然不能保證它能夠串行化。
implements serializable相似詞語(yǔ)短語(yǔ)
1、generalizable───adj.可歸納的;可概括的
2、mineralizable───可礦物化的;使石化的
3、implement a strategy───實(shí)施戰略
4、implement change───實(shí)施變更
5、implementable───可執行的;易于實(shí)施的
6、immortalizable───永垂不朽
7、implement a policy───實(shí)施政策
2、如果父類(lèi)實(shí)現了Serializable并生成了serialVersionUID,而子類(lèi)并沒(méi)有寫(xiě)重新生成serialVersionUID的語(yǔ)句
Android-added: Notes about serialVersionUID, using serialization judiciously, JSON.
Serializability of a class is enabled by the class implementing the
* java.io.Serializable interface. Classes that do not implement this
* interface will not have any of their state serialized or
* deserialized. All subtypes of a serializable class are themselves
* serializable. The serialization interface has no methods or fields
* and serves only to identify the semantics of being serializable.
翻譯:實(shí)現Serializable 接口就能序列化。實(shí)現serializable的類(lèi)的子類(lèi)也是serializable的。
這個(gè)序列化接口沒(méi)有方法或者fields,只是語(yǔ)法標記為可以序列化
上面說(shuō)如果父類(lèi)是序列化的,則子類(lèi)也是序列化的,我們來(lái)做一個(gè)測試
父類(lèi)
public class BaseBean implements Serializable {
public static final int serialVersionUID = 1;
public String property1;
public String property2;
}
子類(lèi)
public class TestBean extends BaseBean {
public String desc;
@Override
public String toString() {
return "TestBean{" +
"desc='" + desc + '\'' +
", property1='" + property1 + '\'' +
", property2='" + property2 + '\'' +
'}';
}
}
測試
public void serialization(View view) {
try {
TestBean testBean = new TestBean();
testBean.property1 = "屬性22882288";
testBean.property2 = "屬性6666";
testBean.desc = "我是testbean";
ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream("/sdcard/aaatest.txt"));
objectOutputStream.writeObject(testBean);
} catch (IOException e) {
e.printStackTrace();
}
}
public void deserialization(View view) {
ObjectInputStream objectInputStream = null;
try {
objectInputStream = new ObjectInputStream(new FileInputStream("/sdcard/aaatest.txt"));
TestBean testBean = (TestBean) objectInputStream.readObject();
Log.i(TAG,"deserialization"+testBean.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
實(shí)測下來(lái),可以正常序列化和反序列化,沒(méi)有問(wèn)題
版權聲明: 本站僅提供信息存儲空間服務(wù),旨在傳遞更多信息,不擁有所有權,不承擔相關(guān)法律責任,不代表本網(wǎng)贊同其觀(guān)點(diǎn)和對其真實(shí)性負責。如因作品內容、版權和其它問(wèn)題需要同本網(wǎng)聯(lián)系的,請發(fā)送郵件至 舉報,一經(jīng)查實(shí),本站將立刻刪除。