How do I get an OutputStream
using org.apache.http.impl.client.DefaultHttpClient
?
I'm looking to write a long string to an output stream.
Using HttpURLConnection
you would implement it like so:
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
OutputStream out = connection.getOutputStream();
Writer wout = new OutputStreamWriter(out);
writeXml(wout);
Is there a method using DefaultHttpClient
similar to what I have above? How would I write to an OutputStream
using DefaultHttpClient
instead of HttpURLConnection
?
e.g
DefaultHttpClient client = new DefaultHttpClient();
OutputStream outstream = (get OutputStream somehow)
Writer wout = new OutputStreamWriter(out);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…