• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Streaming out data using ServletOutputStream

 
Sara Tracy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi !

I'm using the following snippet to read a file contents (data.txt) and stream out through ServletOutputStream.



However, when the file is encrypted, I would like to decrypt it, and then stream it out via ServletOutputStream. I call an encryption program that decrypts the file (dataenc.txt) and returns the data as a byte array. How do I use this byte array with ServletOutputStream ?

I tried using the below code, but nothing is returned.


Can anybody tell me what's wrong in the code ? thanks.
Sara
[ August 09, 2006: Message edited by: Sara James ]
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should flush and close your output stream in both cases. You don't need the intermediate ByteArrayInputStream, either:
 
Sara Tracy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have included close() and flush(). I also got rid of the extra ByteArrayInputStream, but still the file contents aren't displayed.
There is no error as well, not sure where the problem is. Thanks.

Sara
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you made sure that decrypt is doing it's thing right? Printing out the output on the server side?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic