ネットから大きなファイル (1 MB 以上のファイル) をダウンロードできません。ただし、私のプログラムはローカルホストからこれらの大きなファイルをダウンロードできます。大きなファイルをダウンロードするために必要なことは他にありますか? コード スニペットは次のとおりです。
try {
//connection to the remote object referred to by the URL.
url = new URL(urlPath);
// connection to the Server
conn = (HttpURLConnection) url.openConnection();
// get the input stream from conn
in = new BufferedInputStream(conn.getInputStream());
// save the contents to a file
raf = new RandomAccessFile("output","rw");
byte[] buf = new byte[ BUFFER_SIZE ];
int read;
while( ((read = in.read(buf,0,BUFFER_SIZE)) != -1) )
{
raf.write(buf,0,BUFFER_SIZE);
}
} catch ( IOException e ) {
}
finally {
}
前もって感謝します。