Skip to content

Instantly share code, notes, and snippets.

@bigsnarfdude
Created August 25, 2015 22:22
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 bigsnarfdude/2d81595460859966d0d3 to your computer and use it in GitHub Desktop.
Save bigsnarfdude/2d81595460859966d0d3 to your computer and use it in GitHub Desktop.
custom java scala buffer
// this section rewrites the each file byte by byte back to new zip file
while (e.hasMoreElements()) {
val entryIn = e.nextElement().asInstanceOf[ZipEntry]
if (!entryIn.getName.equalsIgnoreCase("abc.txt")) {
zos.putNextEntry(entryIn)
val is = zipFile.getInputStream(entryIn)
val buf = Array.ofDim[Byte](10)
var len: Int = 0
while ((len = (is.read(buf))) > 0) {
zos.write(buf, 0, len)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment