• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Line Endings

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<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
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
No more fooling around. Read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic