学习Java第八周
1.流的分类 1、字节流:Stream 2、字符流: Writer,Reader 输入流 :InputStream ,Reader 输出流 :OuputStream,Writer 字节流重要还是字符流重要:字节流:字节流类为处理字节式输入/输出提供了丰富的环境。 不仅仅可以读二进制,也可以读文本。 字符流:只能读文本。 流的分类: 字节输入流:InputStream 字节输出流:OuputStream 字符输入流:Reader 字符输出流:Writer 2.InputStream流 1、public abstract class InputStream 见到抽象,不能用它创建对象。 2、方法: public abstract int read() throws IOException public int read(byte b[]) throws IOException public int read(byte b[], int off, int len) throws IOException public int available() throws IOException //返回有效字节数。 面试的时候说:请说出available方法的作用:取得有效字节数。不调用read()方法的时候,文件指针指向第一个字符前,后面有文件大小个字符没有读。 public void