I am using this code to download an encrypted file:
InputStream frame = new URL(url).openStream();
ByteArrayOutputStream data = new ByteArrayOutputStream();
int count;
byte[] buff = new byte[10000];
while((count = frame.read(buff)) > 0){
data.write(buff, 0, count);
System.out.println(count);
}
This code works great sometimes, but others it can take up to a minute for a ~36 kilobyte file. Is there a better way of doing this or is the problem simply the connection to the download server?
Aucun commentaire:
Enregistrer un commentaire