Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void readFile(String fileName) {
- FileInputStream fileIS;
- BufferedInputStream bufferedIS;
- DataInputStream dataIS;
- try {
- fileIS = new FileInputStream(fileName);
- bufferedIS = new BufferedInputStream(fileIS);
- dataIS = new DataInputStream(bufferedIS);
- System.out.println("Reading file: " + fileName);
- try {
- while(true) {
- /*
- * reads one input byte, zero-extends it to type int, and
- * returns the result, which is therefore in the range 0
- * through 255.
- */
- int mbyte = dataIS.readUnsignedByte();
- }
- }
- catch (EOFException eof) {
- System.out.println( "Finished reading file" );
- }
- dataIS.close();
- }
- catch (FileNotFoundException e) {
- System.out.println("Error: File not found");
- }
- catch (IOException e) {
- System.out.println("IO error: " + e );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement