正在加载图片...
java. io, ObjectInputStream Cluss FileInputstream fis=new FileInputstream(array. ser); ObjectInputStream ois=new ObjectInputStream(fis); intl arrayln=(intDDois readobjecto; for(int i=0; i<arrayln. length; i++) System. out. print( arraying[i+“t”); TnrowS H. XPnTIon 123456 对象字节流并重构对象,新建的对象相当于 原对象的拷贝java.io.ObjectInputStream Class • 类ObjectInputStream是抽象类InputStream的 子类,并实现了接口DataInput和ObjectInput • 该类的主要功能方法如下: public Object readObject() throws IOException • 该类用于读入由ObjectOutputStream类创建的 对象字节流并重构对象,新建的对象相当于 原对象的拷贝 FileInputStream fis=new FileInputStream("array.ser"); ObjectInputStream ois=new ObjectInputStream(fis); int[] arrayIn=(int[])ois.readObject(); for(int i=0;i<arrayIn.length;i++) System.out.print(arrayIn[i]+“\t”); 1 2 3 4 5 6
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有