• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Streaming out data using ServletOutputStream

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic