| 本帖最后由 joe520kay 于 2015-7-19 09:50 编辑 
 代码如下:
 
 
 package com.joe.io; import java.io.IOException; import java.io.InputStream; public class MyBufferedInputStream {         private InputStream in;         private byte[] buf = new byte[1024];         private int pos = 0, count = 0;         public MyBufferedInputStream() {                 this.in = in;         }         // 一次读一个字节,从缓冲区(字节数组)获取。         public int myRead() throws IOException {                 // 通过in对象读取硬盘上数据,并存储buf中                 if (count == 0) {                         count = in.read(buf);                 //count 代表的是计数器  count = in.read(buf)的意思是?                         if(count<0)                                 return -1;                         pos = 0;                         byte b = buf[pos];                         count--;                         pos++;                         return b;                 }                 else if (count > 0) {                         byte b = buf[pos];                         count--;                         pos++;                         return b;                 }                 return -1;         }         public void myClose() throws IOException {                 in.close();         } }主要不太懂myRead()这个方法,感觉顺序有点乱,有谁可以帮我解答下吗?每一行的代码的意思。
 
 |