Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

ByteArrayInputStream to ByteArrayOutputStream

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please let me know how can I convert ByteArrayInputStream to ByteArrayOutputStream

My scenario is something like this.

1. The getContent() method returns me the ByteArrayInputStream of the content.
2. Now I have to set this content on a new object using setContent(ByteArrayOutputStream) method. This setContent(ByteArrayOutputStream) method accepts ByteArrayOutputStream as parameter.

 
Sheriff
Posts: 22025
108
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Copy the contents from the ByteArrayInputStream to the ByteArrayOutputStream. See the code in http://faq.javaranch.com/java/ReadDoesntDoWhatYouThinkItDoes
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic