@Override public synchronized void close() throws IOException { super.close(); } }
@Override public synchronized void closeEntry() throws IOException { super.closeEntry(); }
/** * Returns the file comment. * * @return The file comment. */ public @Nullable String getComment() { final byte[] comment = this.comment; //return null == comment ? null : new String(comment, charset); return null == comment ? null : decode(comment); }
if (this.finished) return; closeEntry(); final LEDataOutputStream dos = this.dos; this.cdOffset = dos.size(); final Iterator<E> i = this.entries.values().iterator(); while (i.hasNext()) if (!writeCentralFileHeader(i.next())) i.remove(); writeEndOfCentralDirectory(); this.finished = true;
entry.setRawMethod(method = getMethod()); boolean skipCrc = false; if (entry.isEncrypted() || WINZIP_AES == method) { ZipCryptoParameters param = getCryptoParameters(); if (WINZIP_AES == method) { param = parameters(WinZipAesParameters.class, param); processor = newEncryptedOutputMethod((RawOutputMethod) processor, param);
closeEntry(); final OutputMethod method = newOutputMethod(entry, process);
final byte[] name = encode(entry.getName()); dos.writeShort(name.length); dos.writeShort(extra.length); final byte[] comment = getCommentEncoded(entry); dos.writeShort(comment.length);
@Override public @CheckForNull ZipDriverEntry getEntry(final String name) { ZipDriverEntry entry = super.getEntry(name); if (null != entry) return entry; entry = this.bufferedEntry; return null != entry && name.equals(entry.getName()) ? entry : null; }
@Override public synchronized void finish() throws IOException { super.finish(); }
private byte[] getCommentEncoded(final ZipEntry entry) { return encode(entry.getRawComment()); }
/** * {@inheritDoc} * <p> * The initial value is {@code Deflater#DEFAULT_COMPRESSION}. */ @Override public synchronized int getLevel() { return super.getLevel(); }
@Override public synchronized String getComment() { return super.getComment(); }
/** * Returns a clone of the entry for the given name or {@code null} if no * entry with this name exists. * * @param name the name of the ZIP entry. */ @Override public synchronized ZipEntry getEntry(String name) { final ZipEntry entry = super.getEntry(name); return entry != null ? entry.clone() : null; }
/** * Closes this output stream and releases any system resources * associated with the stream. * This closes the open output stream writing to this ZIP file, * if any. * * @throws IOException On any I/O error. */ @Override public void close() throws IOException { finish(); this.delegate.close(); }
/** * Sets the file comment. * * @param comment the file comment. * @throws IllegalArgumentException if the encoded comment is longer than * {@link UShort#MAX_VALUE} bytes. */ public void setComment(final @CheckForNull String comment) { if (null != comment && !comment.isEmpty()) { final byte[] bytes = encode(comment); UShort.check(bytes.length); this.comment = bytes; } else { this.comment = null; } }