Code:
/*
Program to demonstrate BufferedInputStream
*/
import java.io.*;
class BufferedIDemo
{
public static void main(String args[]) throws IOException
{
File file = new File("t1.txt");
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
byte buffer[] = new byte[1024];
int br = bis.read(buffer);
while(br != -1 )
{
System.out.print(new String(buffer,0,br));
br = bis.read(buffer);
}
}
}
Program to demonstrate BufferedInputStream
*/
import java.io.*;
class BufferedIDemo
{
public static void main(String args[]) throws IOException
{
File file = new File("t1.txt");
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
byte buffer[] = new byte[1024];
int br = bis.read(buffer);
while(br != -1 )
{
System.out.print(new String(buffer,0,br));
br = bis.read(buffer);
}
}
}