Java Tutorial

 
 
 
 
import java.io.*;

class  SequenceBuffer
{
    public static void main(String[] args) 
    {
            try{
               FileInputStream file1 = new FileInputStream(\"dataFile1.txt\");
               FileInputStream file2 = new FileInputStream(\"dataFile2.txt\");
               SequenceInputStream resultFile = null;

               resultFile = new SequenceInputStream(file1,file2);

               BufferedInputStream inBuffer = 
                        new BufferedInputStream(resultFile);

              BufferedOutputStream outBuffer =
                        new BufferedOutputStream(System.out);

              int ch;
              while((ch = inBuffer.read())!=1){
                    outBuffer.write((char)ch);
              }
              inBuffer.close();
              outBuffer.close();
              file1.close();
              file2.close();
         }catch(Exception e) {}
    }
}

 
 
Didn't find what you were looking for? Find more on Program of concatenating and Buffering files