View Single Post
Old 05-02-2004, 05:10 PM   PM User | #1
alaios
Regular Coder

 
Join Date: Aug 2002
Posts: 433
Thanks: 3
Thanked 0 Times in 0 Posts
alaios is an unknown quantity at this point
can't read file with Java

Hi .. i want to read a string from a txt file.....
The program returns error at run time from the Java's security class///any idea?

try {
FileInputStream fis = new FileInputStream("README.TXT");
int n;
while ((n = fis.available()) > 0) {
byte[] b = new byte[n];
int result = fis.read(b);
if (result == -1) break;
String s = new String(b);
System.out.print(s);
} // End while
} // End try
catch (IOException e) {System.err.println(e);}
System.out.println();
alaios is offline   Reply With Quote