wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes Strange behaviour of SequenceInputStream with UTF-16 Encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Strange behaviour of SequenceInputStream with UTF-16 Encoding" Watch "Strange behaviour of SequenceInputStream with UTF-16 Encoding" New topic
Author

Strange behaviour of SequenceInputStream with UTF-16 Encoding

cohen schingis
Greenhorn

Joined: Oct 12, 2012
Posts: 1
I tried to create a SequenceStream of UTF-16 encoded files.




if i run this i got this as output:



if i run it, with only one File it works fine:



output:



Where are the Questionsmarks from? how can i handle this?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Welcome to the Ranch, cohen!

It looks to me like the last line in each of the files doesn't have a line-ending character, so when you concatenate the three files, the last line of File 1 and the first line of File 2 look like one line of text. That would at least explain why they are combined that way.

As for the question mark, it looks to me like each of the file has some bytes at the end which (as we already saw) aren't line-endings, but instead are some other character which can't be represented as text.

I would suggest you look at the files to see what's actually happening. A hex editor might be better than an ordinary text editor to do that, since the text editor might hide the file trailer character from you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange behaviour of SequenceInputStream with UTF-16 Encoding
 
Similar Threads
RandomAccessFile()
tricky question
Doubt in Renaming File
please help
declaring array of vectors