Hi all,
I have a ByteArrayInputStream , like following :
"D00AH038600ETB000100130000 6 6PCS
215990707024270702524000"
"D00AH038600ETB000100XXXXXX 6 6PCS
215990707024270702524000"
I have two questions, pls help :
1) How to remove " from it ?
2) The ByteArrayInputStream sent from to client browser (via jsp
page), the question is, why if user display it using NOTEPAD, it does
not separated into 2 (two) lines, but become one long line. ??
Only when I first open it with WordPad it display correctly that save
as txt, then open with Notepad, only then it display correctly.
Thank you very much,
xtanto
Lew - 29 Dec 2007 15:44 GMT
> Hi all,
>
[quoted text clipped - 8 lines]
>
> 1) How to remove " from it ?
You don't remove anything from an input stream directly, you read it. As you
read the data, you process it. Skip over the unwanted characters as you
process the input.
> 2) The ByteArrayInputStream sent from to client browser (via jsp
> page), the question is, why if user display it using NOTEPAD, it does
> not separated into 2 (two) lines, but become one long line. ??
> Only when I first open it with WordPad it display correctly that save
> as txt, then open with Notepad, only then it display correctly.
Where is the client browser?
You have a newline issue - seems that your input is delineated with '\n'
characters. Notepad being the brain-dead thing that it is, only handles
"\r\n" separators correctly. Apparently Wordpad, being the arrogant
know-it-all that it is, decided for you to convert all those standard line
endings into the peculiar Windows variant, thus satisfying Notepad while
corrupting your data.

Signature
Lew
Roedy Green - 29 Dec 2007 21:51 GMT
>1) How to remove " from it ?
Read it char by char copying to a ByteArrayOutputStream (or simple
array) all the non '\"' characters.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com