作用:ObjectInputStream的作用是存储对象,DataInputStream与DataOutputStream存储的是基本的数据类型
方法:
向文件中写数据
writeUTF("你好")能够从输入流中读取采用UTF-8字符编码的字符串
writeByte(12)向文件流写入一个字节
writeChar('1')向文件中写入一个字符
writeBoolean(true)向文件中写入一个布尔值
从文件中读数据
readByte()读一个字节
readChar()读一个字符
readBoolean()读一个布尔值
readUTF()读一个UTF-8编码的字符串
作用:ObjectInputStream的作用是存储对象,DataInputStream与DataOutputStream存储的是基本的数据类型
方法:
向文件中写数据
writeUTF("你好")能够从输入流中读取采用UTF-8字符编码的字符串
writeByte(12)向文件流写入一个字节
writeChar('1')向文件中写入一个字符
writeBoolean(true)向文件中写入一个布尔值
从文件中读数据
readByte()读一个字节
readChar()读一个字符
readBoolean()读一个布尔值
readUTF()读一个UTF-8编码的字符串