/** * Returns the total number of (compressed) bytes this stream has written * to the underlying stream. */ public long length() { return this.dos.size(); }
closeEntry(); final LEDataOutputStream dos = this.dos; this.cdOffset = dos.size(); final Iterator<E> i = this.entries.values().iterator(); while (i.hasNext())
@Override protected void finish() throws IOException { // Flush partial block to out, if any. super.finish(); final long trailer = dos.size(); final Mac mac = this.mac; assert mac.getMacSize() == klac.getMacSize(); final byte[] buf = new byte[mac.getMacSize()]; // MAC buffer int bufLength; // Compute and write the first half of the KLAC to the data envelope footer. // Please note that we will only use the first half of the // authentication code for security reasons. final long length = trailer - start; // message length klac(klac, length, buf); dos.write(buf, 0, buf.length / 2); // Compute and write the first half of the MAC to the data envelope footer. // Again, we will only use the first half of the // authentication code for security reasons. bufLength = mac.doFinal(buf, 0); assert bufLength == buf.length; dos.write(buf, 0, buf.length / 2); assert dos.size() - trailer == buf.length; } }
final long cdEntries = entries.size(); final long cdOffset = this.cdOffset; final long cdSize = dos.size() - cdOffset; final boolean cdEntriesZip64 = cdEntries > UShort.MAX_VALUE || FORCE_ZIP64_EXT; final boolean cdSizeZip64 = cdSize > UInt .MAX_VALUE || FORCE_ZIP64_EXT; if (zip64) { final long zip64eocdOffset // relative offset of the zip64 end of central directory record = dos.size();
this.start = dos.size(); assert ENVELOPE_TYPE_0_HEADER_LEN_WO_SALT + salt.length == start;