/* Read A String (Byte Array) From File using FileInputStream*/
import java.io.*;
class InputStreamDemo1
{
public static void main(String[] args)
{
try
{
File f1=new File("MyFile.txt");
FileInputStream fin=new FileInputStream(f1);
DataInputStream din=new DataInputStream(fin);
byte[] byte_arr=new byte[100];
while(din.available()!=0)
{
System.out.println(din.readLine());
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}



Posted in:
0 comments:
Post a Comment