• Post Reply Bookmark Topic Watch Topic
  • New Topic

writing file to OutputStream  RSS feed

 
sony rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

is it possible to create and write a file into OutputStream without saving the file physically onto any drive. if so how?

thank you in advance
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you can't write (the contents of) a file to an OutputStream if that file does not exist, now can you?

Of course it is possible to copy the contents of any InputStream to any OutputStream without saving the results to a file first:
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the point of creating a file without writing it anywhere? If you want the data to be in memory instead of in a file, you can use a ByteArrayOutputStream.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!