Originally posted by Kim Kantola:
Hi,
the following code will read a file and return the files data a line at a time. I am not sure how you want to process your data, but this part will at least show you how to open a file and access the data a String at a time. bwin.readline() returns a null when it gets to the end of the file.
You can also use just FileReader and do in.read to return a character at a time if that better suits your purpose. (I can send another bit of code showing that if you are interested.)
Hope this helps,
Kim
public void readFile() throws IOException {
File inputFile = new File("C:\\myfile.txt");
FileReader in = new FileReader(inputFile); BufferedReader bwin = new BufferedReader(in);
String line;
while ((line=bwin.readLine()) !=null){
// code here to parse line and/or do
// whatever you want with data
System.out.println(line) // this will show you what you // read in from file
}
bwin.close();
in.close();
}
Originally posted by Cindy Glass:
Well I am not JavaScript expert. What exactly does the escape() do? If you mean an escape character, that is the \ in Java. So \" forces a literal double quote.
If you are just trying to work with hex in java then prefacing the hex value with 0x makes it hex.
0x12 = 18 dec