package io;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
public class DataArrayIO {
public static void main(String[] args) {
try {
//内存的读写(数组储存形式)
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
dos.writeBoolean(true);
dos.writeDouble(999);
//读取数组
ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
DataInputStream dis = new DataInputStream(bis);
System.out.println(dis.readBoolean());
System.out.println(dis.readDouble());
} catch (Exception e) {
// TODO: handle exception
}
}
}
//utf网络应用
09-10
09-10