wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes getting data from an outputstream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "getting data from an outputstream" Watch "getting data from an outputstream" New topic
Author

getting data from an outputstream

mainasiris
Greenhorn

Joined: Apr 18, 2002
Posts: 3
Hi,
I have a requirement where I cannot write the read data to a file simultaneously.
Is there a way where I can write the bytes read from servlet input stream to an output stream ( note : not to a file ) temporarily ; and then use the data conatined in this outputstream to write a file?
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
"mainasiris"
Please review the JavaRanch Naming Policy then edit your profile so that your publicly displayed name complies with the rules.
Thanks for your cooperation.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Is there a way where I can write the bytes read from servlet input stream to an output stream ( note : not to a file ) temporarily ; and then use the data conatined in this outputstream to write a file?
What's wrong with writing it to a file in the first place? FileOutputStream and FileWriter work great for this. If you really need to avoid a file for some unknown reason, you could use something like a ByteArrayOutputStream or a CharArrayWriter to store the data in memory first, and later read the array and write a file. But offhand I can't imagine a reason why this would be useful or necessary, so maybe I'm missing something about your requirements.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting data from an outputstream
 
Similar Threads
Problem in uploading big images
Please help me complete steps to upload an image
how to write the bytes in OutputStream to file?
API to Duplicate/Move Files in Filesystem
File Input and Output Streams