文件输入
- 几种组合流过滤器(FileIntputStream 简写File ,Data,Buffered,Pushback,类似)
-
- 读取字节流,转化为数据;
File - Data - 频繁读取,加入缓冲区;
File - Buffered - Data - 预读、回退;
File - Buffered - Pushback - Data
- 读取字节流,转化为数据;
DataIntputStream din = new DataIntputStream(
new PushbackIntputStream(
new BufferedIntputStream(
new FileIntputStream( "in.dat" ) ) ) );
-
读取写入
-
- 读取:
字节流:DataIntputStream
字符流:Scanner - 写入:
字节流:DataOutputStream
字符流:PrintWriter
- 读取:
-
编码
对于不能表示的,编码,再解码 -
- 编码: String - ByteBuffer (cset.encode) - byte[] ( .array)
- 解码: byte[] - ByteBuffer( ByteBuffer . warp() ) - CharBuffer (cset. decode() ) - String ( toString )