protected void initDirOffsetPosAndComment() throws IOException { // zip files without a comment contain the offset/position of the central directory at this fixed position this.dirOffsetPos = zipFile.length() - 6; final int dirOffset = raFile.readInt( this.dirOffsetPos - 16 ); if( dirOffset!=ENDSIG ) { // if a comment is present, search the ENDSIG constant, starting at the end of the zip file byte[] endsig = ByteArrayHelper.toByteArray((int)ZipConstants.ENDSIG); long endsigPos = raFile.lastPosOf(endsig); if( endsigPos==-1 ) { throw new ZipException("expected ENDSIC not found (marks the beginning of the central directory at end of the zip file)"); } else { this.dirOffsetPos = endsigPos+16; short commentLength = raFile.readShort( this.dirOffsetPos + 4 ); this.comment = new String( raFile.readByteArray( this.dirOffsetPos+6, commentLength ) ); } } }
protected void initDirOffsetPosAndComment() throws IOException { // zip files without a comment contain the offset/position of the central directory at this fixed position this.dirOffsetPos = zipFile.length() - 6; final int dirOffset = raFile.readInt( this.dirOffsetPos - 16 ); if( dirOffset!=ENDSIG ) { // if a comment is present, search the ENDSIG constant, starting at the end of the zip file byte[] endsig = ByteArrayHelper.toByteArray((int)ZipConstants.ENDSIG); long endsigPos = raFile.lastPosOf(endsig); if( endsigPos==-1 ) { throw new ZipException("expected ENDSIC not found (marks the beginning of the central directory at end of the zip file)"); } else { this.dirOffsetPos = endsigPos+16; short commentLength = raFile.readShort( this.dirOffsetPos + 4 ); this.comment = new String( raFile.readByteArray( this.dirOffsetPos+6, commentLength ) ); } } }