Wanted to create an easy interface for reading lines from a stream. It should take care of all the annoying Java IO nitty-gritty for me and I wanted to use it simply by throwing it into a for loop.
Tag Archives: Java
1
Java: How to deal with the BOM in a Unicode InputStream
Ok, so I was happily reading CSV files from an SFTP server. The file content is returned as an InputStream and I I used a BufferedReader to read it line by line. Each line contained either a header or an order. The header lines started with the string “HDR”.
However, I suddenly discovered that my code was consistently skipping the first header (and as a result the orders belonging to it). The reason, I found, was simple. The first header, on the first line, didn’t start with “HDR”, it started with “□HDR”! And that undisplayable square turned out to be a Unicode Byte Order Mark (BOM).
How to set JAVA_HOME and where is whereis on Solaris?
To set the JAVA_HOME environment variable you first need to find where your Java installation is located and then set it somehow.
Test-Driven Development: By Example

Book cover