Created
January 11, 2012 19:09
-
-
Save yanaga/1596238 to your computer and use it in GitHub Desktop.
Exemplo de ZipInputStream sem arquivos (somente memória)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Massacration! Vou testar depois :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Neste exemplo, o "out" possui o conteúdo do arquivo descompactado. Você pode enviá-lo para onde quiser...