import java.io.*;
public class InputBytes 
{
	public static void main (String args[]) 
	{
		try 
		{
			FileInputStream file = new FileInputStream ("OutBytes.class");
			boolean eof = false;
			int count = 0;
			while (!eof) 
			{
				int in_put = file.read();
				System.out.print(in_put +" ");
				if(in_put==-1)
					eof = true;
				else
					count++;
			}
			file.close();
			System.out.println("\nTotal number of bytes read "+count);
		}
		catch(IOException e)
		{
			System.out.println("Error");
	 	} 
  	}
}

Click here to go back.

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus


Footer1