hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsona laio <freeonf...@yahoo.co.uk>
Subject save file problem
Date Mon, 06 Dec 2004 05:38:38 GMT
Hi,
Lately I write a simple program follow up the sample
code on http client
(http://jakarta.apache.org/commons/httpclient/tutorial.html).
I want to save a file after gettin the content from
the web (an zip file format), which associate with an
inputStream (with post method getResponseBody() ).
But I encounter a problem when compiling source code.
What should I do in order to save a file correctly? Or
where there's resource talking about this.
I appreciate it sincerely.
Jason.

============BEG=============
HttpClientTutorial.java:47:
ObjectOutputStream(java.io.OutputStream) in java.io.
ObjectOutputStream cannot be applied to ()
ObjectOutputStream out = new ObjectOutputStream() ;
^
============END=============
=========beg save file snippet source====
byte[] bytes = new byte[10240];
ObjectInputStream ois = new ObjectInputStream(in);
ObjectOutputStream out = new ObjectOutputStream() ;
int beg = 0;
int len = 0;
long c =0;
while(ois.read(bytes)!=-1){
out.write(bytes, beg , 10240);
beg += 10240;
}
ois.close();
out.close();
=========end save file snippet source====


		
___________________________________________________________ 
Win a castle for NYE with your mates and Yahoo! Messenger 
http://uk.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message