Originally Posted by
KevinWorkman
Okay, gotcha. I assume that eclipse has its own JDK tucked away somewhere, but a JDK is simply the set of tools that compile your java code into bytecode (namely the javac tool). Compare that to the JRE, which is the set of tools that run compiled bytecode. Eclipse might hide it, but behind the scenes it has to be using a JDK, even if it's not installed where you'd expect. Most people install a JDK like I have above so that they can compile with the command prompt. The source comes with the "real" (non-eclipse) JDK, which is another reason it's a good thing to have.
Thank you. I suspected, but it's been a while since I've used precise terminology (I'm not actually a native English speaker) so I'm not sure if I was ever clear on this. I'll see about getting the actual JRE, though I still prefer Eclipse. The ease of use of the editor's functions is too good to pass up. At this point I'm hooked on code-complete as a means of avoiding spelling errors (sloppy typist here).
Originally Posted by
helloworld922
As far as I know the Scanner class is a convenient Regex-wrapper for any incoming stream. What stream you pass to it will determine if the file is buffered in memory or not.
Scanner buffed_reader = new Scanner(new BufferedReader(new FileReader("file.txt"))); // file gets buffered into memory, usually faster
Scanner unbuffed_reader = new Scanner(new FileReader("file.txt")); // file isn't buffered into memory
That being said, I don't know what the behavior is if you pass a file to the Scanner object directly (though it sounds like it isn't).
Wait, I can pass a BufferedReader to a Scanner? But I thought its constructor expected a Stream child, not a Reader child? Yes, if I can pass a BufferedReader, then I'd expect the Scanner's behaviour to build on that of the underlying reader object, so I'd expect it to use said reader's buffer. I didn't know I could do that, though.
Originally Posted by
helloworld922
It's also possible that it's the Regex side which is slowing your application down. If all you need is basic read-line stuff Scanners may be overkill. Scanners work best when you're parsing the data while your reading it in (such as reading in a file of numbers).
I'm not just reading the data, I need to split it into tokens. Each row comes in six parts - one header and five number columns. Originally, I was using a BufferedReader and then post-splitting and converting the coming Strings, which really isn't a good idea. After having my post moderated in another thread, it gave me the idea of using a StringTokenizer, instead. I haven't read up enough on it to know for certain, but this seems like an easier way to get tokens out of a file reader than a Scanner, which does indeed seem to want to parse my data. I suspect that might be faster, though I don't know if the StringTokenizer itself won't reintroduce some slowdown.
In any event, the previous memory problem and the Scanner's slowdown forced me to admit defeat and move the software to our server so it can use more operating memory. It's either that or take ages to accomplish anything.