在Java中,flush()方法用于流中.但我不明白使用这种方法的目的是什么?
fin.flush();
Run Code Online (Sandbox Code Playgroud)
告诉我一些建议.
我通过org.apache.http.client.HttpClientandroid 上传文件,我需要实现进度条.是否有可能从以下方面获取进展:
HttpPost httppost = new HttpPost("some path");
HttpClient httpclient = new DefaultHttpClient();
try {
File file = new File("file path");
InputStream in = new BufferedInputStream(new FileInputStream(file));
byte[] bArray = new byte[(int) file.length()];
in.read(bArray);
String entity = Base64.encodeToString(bArray, Base64.DEFAULT);
httppost.setEntity(new StringEntity(entity));
HttpResponse response = httpclient.execute(httppost);
}
Run Code Online (Sandbox Code Playgroud)
如果没有,请显示另一种方式.谢谢