| Author |
Line Endings
|
V Bose
Ranch Hand
Joined: Jul 10, 2003
Posts: 113
|
|
I'm trying to use the class to read from a collection of s. Assuming I have two seperate InputStreams wrapping two seperate files that look something like - File A: Line 1 : Apple Line 2 : Oranges<EOF> File B: Line 1 : Pears Line 2 : Grapes<EOF> When I try to concatenate these two streams and read them using java.io.SequenceInputStream, Line 1: Pears is never read.(Assuming the concatenation ordering is File A, File B) But if I change File A to this - File A: Line 1 : Apple Line 2 : Oranges <EOF> (there is a <CR> after Oranges this time), then it works fine. Is this something to do with how <EOF>s are encoded in Windows?
|
 |
Joni Salonen
Ranch Hand
Joined: Jan 07, 2006
Posts: 53
|
|
<EOF> is not a character that is present in the file. This discussion is written for C/C++ but appliest just as well in Java: http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048865140&id=1043284351 If you have problems reading past the contents of the first file, there has to be some other problem. Can you post a small snippet of code that demonstrates your problem?
|
 |
Joni Salonen
Ranch Hand
Joined: Jan 07, 2006
Posts: 53
|
|
ah, now i get it. when you concatenate the two files you end up with because there is no line break after the last line of the first file or before the first line of the second file.
|
 |
 |
|
|
subject: Line Endings
|
|
|