Copy byte between BufferedInputStream and BufferedOutputStream
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
class BufferedCopy {
public static void main(String[] args) throws Exception {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
FileInputStream fis = new FileInputStream(args[0]);
bis = new BufferedInputStream(fis);
FileOutputStream fos = new FileOutputStream(args[1]);
bos = new BufferedOutputStream(fos);
int byte_;
while ((byte_ = bis.read()) != -1)
bos.write(byte_);
}
}
Related examples in the same category