Code example for ZipOutputStream

Methods: closeEntry, putNextEntry, write

0
      } else { 
        fname = key.toString();
      } 
 
      ZipEntry ze = new ZipEntry(fname);
      zipOut.closeEntry();
      zipOut.putNextEntry(ze);
 
      if (value instanceof BytesWritable) {
        zipOut.write(((BytesWritable) value).getBytes(), 0, ((BytesWritable)value).getLength());
      } else { 
        zipOut.write(value.toString().getBytes());
      } 
 
    } 
 
    @Override 
    public void close(Reporter reporter) throws IOException {
      zipOut.finish();
      zipOut.close();
    }