package myFileInputStreamDemo;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class FileInputStreamDemo01 {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("Test//fos.txt");
int by;
while ((by = fis.read()) != -1) {
System.out.print((char)by);
}
fis.close();
}
}
package myFileInputStreamDemo;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class FileInputStreamDemo02 {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("Test//fos.txt");
byte[] bytes = new byte[1024];
int len;
while((len = fis.read(bytes)) != -1) {
System.out.print(new String(bytes, 0, len));
}
fis.close();
}
}