phil wilson :: a geek commodity

1:50 PM

permanent link to post  

Tuesday, June 17, 2003

They say you can hold seven plus or minus two pieces of information in your mind. I can’t remember how to open files in Java.


Something similar happened to me last night. I couldn’t remember how to get command-line user input. Oh sure, came into it somewhere, and, so I thought, all I had to do was wrap a BufferedInputStream around it and all done. Nope.

Obivously it’s because I’ve been doing so much server-side work for so long, and whenever I’ve done client-side apps, they’ve been swing or thinlet-based. The last time I took input from the command line in a Java app was 2001. That’s two years ago; still, like Bruce I’ve done it a bunch of times, but it’s too many steps. – remember that to print text out it’s one small call (System.out.println("this is easy");), but reading text in and echoing it back is a minimum of four lines of code, and not including the three import statements (or one if you’re naughty).

Anyway, for the curious, it’s BufferedReader that gives the magic of readLine(). I wish it was a lot easier to find these things out (I ended up having to do a search for "readLine()" on my API directory).