次のコードを使用して、URL からファイルをダウンロードします。
while(status==Status.DOWNLOADING){
HttpURLConnection conn=(HttpURLConnection)url.openConnection();
conn.connect();
int size=conn.getContentLength();
BufferedInputStream bin=new BufferedInputStream(conn.getInputStream());
byte[] buffer=new byte[1024];
int read=bin.read(buffer);
if(read==-1)
break;
downloaded+=read;
}
一部の URL の read() メソッドでは、ダウンロードのサイズ (コンテンツの長さ) まで読み取る前に -1 を返します。
このコードで何が起こっているのか、誰でも私に提案できますか..
plsはあなたの提案を提供..