Skip to content

Instantly share code, notes, and snippets.

@yanaga
Created January 11, 2012 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanaga/1596238 to your computer and use it in GitHub Desktop.
Save yanaga/1596238 to your computer and use it in GitHub Desktop.
Exemplo de ZipInputStream sem arquivos (somente memória)
ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream(inputStream));
for (ZipEntry entry = null; (entry = zipInputStream.getNextEntry()) != null;) {
String name = entry.getName();
ByteArrayOutputStream out = new ByteArrayOutputStream();
for (int i = 0; (i = zipInputStream.read()) != -1;) {
out.write(i);
}
out.close();
}
zipInputStream.close();
@yanaga
Copy link
Author

yanaga commented Jan 11, 2012

Neste exemplo, o "out" possui o conteúdo do arquivo descompactado. Você pode enviá-lo para onde quiser...

@klauswuestefeld
Copy link

Massacration! Vou testar depois :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment