hello..can anybody give me a guide on how to read any file using java..i am working in encrypting files..any file..can anybody give a hand.
hi. here is a way that you can read the content of a file, but before you should specify your file name
FileInputStream fis = new FileInputStream("E:/Sahar/source codes/exam.txt");
int num = fis.available();
byte b[] = new byte[num];
fis.read(b);
String content = new String(b , 0 , num);
System.out.println("content : "+ content);
in the 1st line, you shud write d name of file u want work on it
in d 2nd line: u r asking to find d number of bytes that can b read from fiel
in d 3rd line: making a byte array with d size of ur file
.......: reading byte by byte of file
.......: making a string to write d result of reading file
.......: and finally writing d result as a string