
write a java program to read a file content into a string object using available and read methods of java bufferedinputstream.

Please visit the following link:
http://www.roseindia.net/java/example/java/io/ReadFilterFile.shtml

import java.io.*;
class ReadFile
{
public static void main(String args[])
{
try
{
FileInputStream fin = new FileInputStream("C:/hello.txt");
BufferedInputStream bis = new BufferedInputStream(fin);
while (bis.available() > 0)
{
String st=Character.toString((char)bis.read());
System.out.print(st);
}
}
catch (Exception e)
{
System.err.println("Error reading file: " + e);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.