File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutputStream

 
Andy Hahn
Ranch Hand
Posts: 225
  • 0
  • 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
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic