File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Line Endings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Line Endings" Watch "Line Endings" New topic
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Line Endings