reader.java - } public byte Read () throws IOException { int

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; class Reader { String fileName; int counter; byte[] data; BufferedInputStream in; public Reader(String fileName) throws FileNotFoundException { this.fileName=fileName; counter=0; data = new byte[512]; in = new BufferedInputStream(new FileInputStream("c:\\temp\\"+fileName));
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } public byte Read () throws IOException { int i=in.available(); if(i<512){ byte g=new byte[i]; counter =in.read(g); in.close(); return g; } counter = in.read(data); if(counter == -1){ in.close(); } return data; } }...
View Full Document

Ask a homework question - tutors are online