Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reading the binary data from the text file

807580Feb 2 2010 — edited Feb 2 2010
Hi: Gurus I exported a table to text file with a column that has Blob (binary data) value. I am trying to read and parse the text file with the binary data (blob) but noticed when I read the blob columns as String and create an inputstream object like this

InputStream ins = new ByteArrayInputStream(blobColumnInTextFile.getBytes());
int length = 0;
while ((length = ins.read(buffer)) != -1) {
out.write(buffer, 0, length);

and then writes this input stream to outputstream (see above) the columns fields change from the binary hex digits to decimal digits.

E.g lets say the binary column in exported file is some thing like this "89504e470d0a1a", the output stream converts every thing (Hex code) to decimal like this "3839353034653437306430613". Can some one give me the pointer about how can I read the binary data from the text file and write it to the outputstream without loosing the binary format as it is.

Thanks,
RJ.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 2 2010
Added on Feb 2 2010
3 comments
391 views