如何获得OutputStream
using org.apache.http.impl.client.DefaultHttpClient
?
我正在寻找将长字符串写入输出流。
使用HttpURLConnection
你会像这样实现它:
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
OutputStream out = connection.getOutputStream();
Writer wout = new OutputStreamWriter(out);
writeXml(wout);
有没有使用DefaultHttpClient
类似于我上面的方法?我将如何写入OutputStream
usingDefaultHttpClient
而不是HttpURLConnection
?
例如
DefaultHttpClient client = new DefaultHttpClient();
OutputStream outstream = (get OutputStream somehow)
Writer wout = new OutputStreamWriter(out);