I have problem with BufferedReader.
My source code works fine, but the problem is when I read a value from named pipe it missed some values.
delim="\t";
reader = new BufferedReader(new FileReader("/tmp/base.pip"));
while ((line = reader.readLine())!=null) {
try{
timestamp = Long.parseLong(line.split(delim)[0]);
}
catch(Exception e){
continue;
}
I need to read whole line to get first column value properly.
original line : 12345678 A B
readed line: 2345678 A B (missed first bit)
Is there any suggestion to solve this problem?
p.s it works fine, but only a few lines have problem like the above examples.
I've tested your program and it works fine on my computer.
String delim = "\t"
tab
seperator between them.line
value in your program.If you don't have a tab space, consider using a regular expression which accepts any number of spaces.
String delim = "\\s+";
delim = '\t'
Split cannot take a character as a delimiter. Please check that. It has to be delim = "\t"