我想向各位高手请教关于对象序列化的问题! 现在很急,多谢各位! 可以.但是类A不会包含在序列化的数据中. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 试试看。public static byte[] bwritedato(Object data) { byte[] bx = new byte[1]; try { ObjectOutputStream fin; ByteArrayOutputStream b = new ByteArrayOutputStream(); fin = new ObjectOutputStream(b); fin.writeObject(data); fin.flush(); fin.close(); fin = null; bx = new byte[b.size()]; bx = b.toByteArray(); } catch(Exception e) { log(" bAppending/writing object data error : " + e.toString()); } return bx; } public static Object breaddato(byte[] data) { Object bx = new Object(); try { ObjectInputStream fin; ByteArrayInputStream b = new ByteArrayInputStream(data); fin = new ObjectInputStream(b); bx = fin.readObject(); fin.close(); fin = null; } catch(Exception e) { log(" bAppending/writing object data error : " + e.toString()); } return bx; } 大专毕业生的工作疑惑 请教java和c++高手,帮忙翻译一个加密算法 初级新手的问题 有关获取路径的疑问 JAVA关于图像问题 关于一个运行时错误的问题? 急!用jdbc连接sql2000 如何在drawString绘出的文字上加入背景颜色!!!! 那位大哥哥有将rational rose 2001与jbulider 6.0配合使用的经验啊? 如何获取对子进程的控制? 在window 下如何编译这种java文件! skyyoung(路人甲):
{
byte[] bx = new byte[1];
try
{
ObjectOutputStream fin;
ByteArrayOutputStream b = new ByteArrayOutputStream();
fin = new ObjectOutputStream(b);
fin.writeObject(data);
fin.flush();
fin.close();
fin = null;
bx = new byte[b.size()];
bx = b.toByteArray();
}
catch(Exception e)
{
log(" bAppending/writing object data error : " + e.toString());
}
return bx;
} public static Object breaddato(byte[] data)
{
Object bx = new Object();
try
{
ObjectInputStream fin;
ByteArrayInputStream b = new ByteArrayInputStream(data);
fin = new ObjectInputStream(b);
bx = fin.readObject();
fin.close();
fin = null;
}
catch(Exception e)
{
log(" bAppending/writing object data error : " + e.toString());
}
return bx;
}