java - Android: downloading large zipped file -
i've got problem in downloading large zipped file in android. when i'm downloading small file (i.e. 20 mb) ok, when trying download large file (i.e 100 mb) cannot unzip after downloading because corrupt. here code:
final url url = new url(url)); final httpurlconnection urlconnection = (httpurlconnection) url.openconnection(); file file = new file(mcontext.getfilesdir(), params[0]); file.getparentfile().mkdirs(); fileoutputstream fos; fos = new fileoutputstream(file); inputstream input = urlconnection.getinputstream(); bufferedinputstream bis = new bufferedinputstream(input); byte[] buffer = new byte[1024]; int read = bis.read(buffer); while(read != -1){ fos.write(buffer, 0, read); read = bis.read(buffer); } fos.close(); bis.close();
Comments
Post a Comment