BufferedCopy.java Source code

Java tutorial

Introduction

Here is the source code for BufferedCopy.java

Source

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_);
    }
}