Click here to watch in Youtube :
https://www.youtube.com/watch?v=uw9h73Jni6Q&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java IO (SequenceInputStream) |
Java Tutorial : Java IO (SequenceInputStream) |
Java Tutorial : Java IO (SequenceInputStream) |
myfile1.txt
Peter is going to India,Join is going to India,
Welcome to America,Welcome to India
import java.io.FileInputStream; import java.io.IOException; import java.io.SequenceInputStream; public class SequenceInputStreamDemo { public static void main(String[] args) throws IOException { FileInputStream fileInputStream1 = null; FileInputStream fileInputStream2 = null; SequenceInputStream sequenceInputStream = null; try { fileInputStream1 = new FileInputStream("myfile1.txt"); fileInputStream2 = new FileInputStream("myfile2.txt"); sequenceInputStream = new SequenceInputStream(fileInputStream1, fileInputStream2); int i; while ((i = sequenceInputStream.read()) != -1) { System.out.print((char) i); } } finally { if(fileInputStream1!=null) { fileInputStream1.close(); } if(fileInputStream2!=null) { fileInputStream2.close(); } if(sequenceInputStream!=null) { sequenceInputStream.close(); } } } }
Peter is going to India,Join is going to India,Welcome to America,Welcome to India
https://sites.google.com/site/ramj2eev1/home/javabasics/JavaIODemo_SequenceInputStream_Intro_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/JavaIODemo_SequenceInputStream_Intro_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d261aab7f0b47dd247e532c02763fe1d7053f5d3/BasicJava/JavaIODemo_SequenceInputStream_Intro_App/?at=master
See also:
No comments:
Post a Comment