求对象序列化后传输的数据大小,以字节或者KB来表示 JAVA中有这种函数可以来计算序列化后对象的实际大小么(以KB或者字节计算),还是要用外部辅助工具来截数据包~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是通过ObjectIn(Out)putStream来传输,知道大小不难吧 //一个实现序列化接口的对象MMMM m=new MM();ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream("xxxx.file"));out.writeObject(xx);out.close();File f = new File("xxxx.file"); if (f.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(f); } catch (FileNotFoundException e) { e.printStackTrace(); } try { System.out.println("File has " + (double)((double)fis.available()/1000) + "KB"); } catch (IOException e) { e.printStackTrace(); } ByteArrauOutputStream中有toByteArray方法 Java程序 用jasperreport+ireport导出Excel表格的问题 求助一个java程序 怎么对java的源代码进行分析。 java 多媒体 rs.absolute(-1)出问题 求能够快速大量访问网络的办法。 请问各位几个关于java网络编程的简单问题,谢谢! JAVA用JDBC.ODBC桥后,就失去了跨平台,欢迎讨论。 几个非常菜鸟的问题,请各位大侠帮忙! java Swing 中实现下载一个页面里面的所有内容 java线程怎么给调用返回输出结果字符串啊?
MM m=new MM();ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream("xxxx.file"));
out.writeObject(xx);
out.close();File f = new File("xxxx.file");
if (f.exists()) {
FileInputStream fis = null;
try {
fis = new FileInputStream(f);
} catch (FileNotFoundException e) {
e.printStackTrace();
} try {
System.out.println("File has " + (double)((double)fis.available()/1000)
+ "KB");
} catch (IOException e) {
e.printStackTrace();
}