getInputStream()を使用してデコード中に HTTP 接続から接続しようとしてBitmatpFactoryいるため、BitmatpFactoryファクトリは入力ストリームがデータを収集するのを常に待機する必要がありました。
そして、入力ストリームがまったく表示されませんclose()-ブリキのfinallyブロックを期待しているため、さらにエラーが発生する可能性があります。
これを試して:
また、接続帯域幅をチェックして、実行していることがこの要因 (ネットワーク帯域幅) によって制限されていることを確認してください。
[更新] これらはいくつかのユーティリティ関数です:
/**
* Util to download data from an Url and save into a file
* @param url
* @param outFilePath
*/
public static void HttpDownloadFromUrl(final String url, final String outFilePath)
{
try
{
HttpURLConnection connection = (HttpURLConnection) (new URL(url)).openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.connect();
FileOutputStream outFile = new FileOutputStream(outFilePath, false);
InputStream in = connection.getInputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = in.read(buffer)) > 0)
{
outFile.write(buffer, 0, len);
}
outFile.close();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
/**
* Spawn a thread to download from an url and save into a file
* @param url
* @param outFilePath
* @return
* The created thread, which is already started. may use to control the downloading thread.
*/
public static Thread HttpDownloadThreadStart(final String url, final String outFilePath)
{
Thread clientThread = new Thread(new Runnable()
{
@Override
public void run()
{
HttpDownloadFromUrl(url, outFilePath);
}
});
clientThread.start();
return clientThread;
}