I made a simple parser with java that reads a file one character at a time and constructs words.
I tried to run it under Linux and I noticed that looking for '\n' doesn’t work. Although if I compare the character with the value 10 it works as expected. According to the ASCII table value 10 is LF (line feed). I read somewhere (I don’t remember where) that Java should be able to find a newline only by looking for '\n'.
I am using BufferedReader and the read method to read characters.
EDIT
readLine cannot be used because it will produce other problems
It looks like the problem appears when I am using files with mac/windows file endings under linux.
here are two ways can do it
1- use read line by line and split each using a regular expression to get the single words
2- write your own isDelimiter method and use it to check whether you reached a split contition or not