黑马程序员 java IO机制
一个是操作数据的方式是可以组合使用的,如:
package java.io;public abstract class InputStream implements Closeable {// MAX_SKIP_BUFFER_SIZE is used to determine the maximum buffer size to // use when skipping.private static final int MAX_SKIP_BUFFER_SIZE = 2048;// 是个抽象类需要子类实现// return:int型 0-255(表示读出的那个字节)// 如果是-1,说明读完了public abstract int read() throws IOException;// 一看就知道这个read用的就是再下面那个read的返回值// 只是这个read是尽字节数组b最大的能力去read而已public int read(byte b[]) throws IOException { return read(b, 0, b.length); }// 这个read是不尽字节数组b最大能力去read,而是可以设置off和len// return:0 表示len=0(一般不会出现)//-1 用的是抽象函数read()的返回值,读完了// (int)i 读出了i个字节public int read(byte b[], int off, int len) throws IOException { /**内容省略,自己查看 有调用read()那个抽象方法哦**/ }public long skip(long n) throws IOException { /**内容省略,自己查看**/ }public int available() throws IOException { return 0; }// Closeable接口的方法public void close() throws IOException {}// 配合reset()一起用public synchronized void mark(int readlimit) {}public synchronized void reset() throws IOException { throw new IOException("mark/reset not supported"); } public boolean markSupported() { return false; }}
未完待续…………