Wednesday, September 28, 2011

Read a file using BufferedInputStream

BufferedInputStreamExample.java
----------------------------------------------------------------------------------
import java.io.*;

public class BufferedInputStreamExample {
        public static void main(String[] args) throws Exception {
           
                BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:/logins.txt"));
                while (bis.available() > 0)
                {
                System.out.print((char)bis.read());
                }
                 bis.close();
        }
}

No comments:

Post a Comment