public void finish() throws IOException {
  if (out == null) {
    throw new IOException("Stream is closed");
  }
  if (cDir == null) {
    return;
  }
  if (entries.isEmpty()) {
    throw new ZipException("No entries");
  }
  if (currentEntry != null) {
    closeEntry();
  }
  int cdirEntriesSize=cDir.size();
  writeLongAsUint32(cDir,ENDSIG);
  writeIntAsUint16(cDir,0);
  writeIntAsUint16(cDir,0);
  if (archiveNeedsZip64EocdRecord) {
    writeIntAsUint16(cDir,0xFFFF);
    writeIntAsUint16(cDir,0xFFFF);
    writeLongAsUint32(cDir,0xFFFFFFFF);
    writeLongAsUint32(cDir,0xFFFFFFFF);
  }
 else {
    writeIntAsUint16(cDir,entries.size());
    writeIntAsUint16(cDir,entries.size());
    writeLongAsUint32(cDir,cdirEntriesSize);
    writeLongAsUint32(cDir,offset);
  }
  writeIntAsUint16(cDir,commentBytes.length);
  if (commentBytes.length > 0) {
    cDir.write(commentBytes);
  }
  cDir.writeTo(out);
  cDir=null;
}

public void finish ( ) throws IOException { if ( out == null ) { throw new IOException ( "Stream is closed" ) ; } if ( cDir == null ) { return ; } if ( entries . isEmpty ( ) ) { throw new ZipException ( "No entries" ) ; } if ( currentEntry != null ) { closeEntry ( ) ; } int cdirEntriesSize = cDir . size ( ) ; writeLongAsUint32 ( cDir , ENDSIG ) ; writeIntAsUint16 ( cDir , 0 ) ; writeIntAsUint16 ( cDir , 0 ) ; if ( archiveNeedsZip64EocdRecord ) { writeIntAsUint16 ( cDir , 0xFFFF ) ; writeIntAsUint16 ( cDir , 0xFFFF ) ; writeLongAsUint32 ( cDir , 0xFFFFFFFF ) ; writeLongAsUint32 ( cDir , 0xFFFFFFFF ) ; } else { writeIntAsUint16 ( cDir , entries . size ( ) ) ; writeIntAsUint16 ( cDir , entries . size ( ) ) ; writeLongAsUint32 ( cDir , cdirEntriesSize ) ; writeLongAsUint32 ( cDir , offset ) ; } writeIntAsUint16 ( cDir , commentBytes . length ) ; if ( commentBytes . length > 0 ) { cDir . write ( commentBytes ) ; } cDir . writeTo ( out ) ; cDir = null ; }
indicates that all entries have been written to the stream . any terminal information is written to the underlying stream .
