私は現在、Web上にあるファイルを読み取り、電話のファイルに書き込む次のコードを持っています:
InputStream inputStream = new URL(sourceFileWebAddress).openStream();
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
int count;
byte buffer[] = new byte[1024];
while ((count = bufferedInputStream.read(buffer, 0, buffer.length)) != -1)
fileOutputStream.write(buffer, 0, count);
ダウンロードを開始する前に読み取られる合計バイト数を決定することが可能かどうか (上記の設定を使用するか、別の方法で) (ダウンロードの進行中にパーセンテージの進行状況をユーザーに公開するため) を知っている人はいますか?