Preview:
import java.io.*;

public class InputStreamDemo{
	public static void main(String[] args){
	FileInputStream fis = null;
	try{
		fis = new FileInputStream("InputStreamDemo.java");
		System.out.println("Available data: "+fis.available()+" bytes");
		int c = fis.read();
		while(c!=-1){
			System.out.println((char)c);
			c = fis.read();
		}
	}
	catch(IOException ie){
		ie.printStackTrace();
	}
	finally{
		try{
			if(fis!=null)
				fis.close();
		}
		catch(IOException ie){
			ie.printStackTrace();
		}
	}
	}
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter