• Post Reply Bookmark Topic Watch Topic
  • New Topic

OutputStream  RSS feed

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using a method that writes it's contents to an output stream.
How can I instead capture those contents into a java String?



Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a ByteArrayOutputStream to collect the data, then use toByteArray() to get the bytes, and then construct a String from them.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!