A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
I/O and Streams
Save pdf from http inputstream to file
Joined: Nov 03, 2008
Jan 12, 2009 08:01:16
Hi, i'd like to ask how can I save the
file being sent from an HttpUrlConnection to a file?
Im using an
to call a report from ms sql server report server. This should return a pdf file.
Then upon checking the getInputStream(), and writing the stream as
, I can tell that the contents are the pdf file itself(although it prints out probably hex values).
Normally, if it is run in a web application, it displays the pdf automatically.
But im running the code in a desktop environment (probably command line only). So what i need is to get the inputstream of the httpurlconnection, and save it to its PDF file.
Other approach is welcomed also... thank you!
Joined: Mar 22, 2005
Jan 12, 2009 09:03:45
This should help:
Ping & DNS
- my free Android networking tools app
Joined: Oct 08, 2006
Jan 12, 2009 09:06:48
Basically you just need to write it to
author and iconoclast
Joined: Jul 08, 2003
Jan 12, 2009 10:55:27
... without converting it to a String. Read into a byte, and save the byte to a
[Jess in Action]
I agree. Here's the link:
subject: Save pdf from http inputstream to file
httpurlconnection for uploading a file
modified PDF/image to be sent to servlet
Save an InputStream to a file
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014