关于文件缓冲(新手问题)
如果我的文件大于缓冲区大小,当读完缓冲区之后,如何接着读取文件剩余的部分呢?用mark会不会改变流呢?如果会那怎么样才能不改变流也能实现呢?
------解决方案--------------------import java.io.*;;
public class DD {
public static void main(String[] args) throws Exception {
FileInputStream in= new FileInputStream( "d:/22.txt ") ;
BufferedInputStream in1=new BufferedInputStream(in);
FileOutputStream out=new FileOutputStream( "d:/dd.txt ");
BufferedOutputStream out1=new BufferedOutputStream(out);
int data;
byte []by=new byte[100];
while((data=in1.read(by))!=-1){
//System.out.print((char) data);
out1.write(by, 0, data);
}
out1.close();
}
}