26 October 2004 - java_dev (original) (raw)
Java developers
October 26th, 2004
| | 01:05 am - battie42 - Reading in files using StringTokenizer Hi again.I'm trying to get Java to read in a text file I created. I can't figure out what sort of encoding it needs to be read properly. At first I used Notepad's default ANSI encoding, but the tokenizer kept giving me a null pointer exception (even though my test print statement revealed that the line was being read in correctly). I switched it to Unicode, and the file reader was able to read the first few string tokens. However, it can't parse integers from it.I finally modified the code so that the program would just create the file itself, and it did so just fine. It also saved it as the default ANSI. And then it couldn't read the stupid thing back in.I was going include a screenshot of the error message for the Unicode, but my image server is down. I'll see if I can get it up later if someone needs it.What format should I be using? I'd like to try ASCII but I can't find anything that will save it with that encoding.Thanks. |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
02:13 pm - |
---|
10:59 pm - |
---|