サーバーに 40 MB のファイルがあり、次を使用してファイルをダウンロードしています
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);
c.connect();
FileOutputStream f = new FileOutputStream(new File("trips.xml"));
InputStream in = c.getInputStream();
byte[] buffer = new byte[1024];
int len1 = 0;
while ( (len1 = in.read(buffer)) != -1 ) {
f.write(buffer,0, len1);
このコードは正常に動作しているように見えますが、時間がかかりすぎます。このプロセスを高速化できる方法はありますか。
/ミンハズ