Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

How to remove " from ByteArrayInputStream ?

Thread view: 
krislioe@gmail.com - 29 Dec 2007 13:29 GMT
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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.