Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

OutputStream System.out to String BLOB

 
Imre Tokai
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello!


I have a piece of code:

where byteArray is a BLOB type.
This is working fine.

Instead of the output stream, i want to convert bytes to string. So, i need sg like StringOutputStrem.


What classes should i use and how?

Regards
 
Sivakumar Janardhanan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Report post to moderator
I think you should use String class.String class has a lot of method.So you can able to convert bytearray to String.

you try this one:

Convert the byte array to a String using the constructor

String byteString = new String(byte[] bytes) ;

do the replacement

byteString = byteString.replace("bert|ernie" , "") ;

and convert back

byte [] newBytes = byteString.getBytes() ;

and then write it out :-)
 
Rob Spoor
Sheriff
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Imre, after a few months I would expect you knew to Use One Thread Per Question. This is the exact same question as this one.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Rob Prime:
Imre, after a few months I would expect you knew to Use One Thread Per Question. This is the exact same question as this one.
I hadn't noticed.

Closing thread.
 
    Bookmark Topic Watch Topic
  • New Topic