/** * Checks whether the entry requires features not (yet) supported * by the library and throws an exception if it does. */ static void checkRequestedFeatures(final ZipArchiveEntry ze) throws UnsupportedZipFeatureException { if (!supportsEncryptionOf(ze)) { throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException .Feature.ENCRYPTION, ze); } if (!supportsMethodOf(ze)) { final ZipMethod m = ZipMethod.getMethodByCode(ze.getMethod()); if (m == null) { throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException .Feature.METHOD, ze); } throw new UnsupportedZipFeatureException(m, ze); } } }
/** * @param <T> {@link #handleNormalContents(InputStream)} returns a value of this type, * which is, in turn, returned by the {@code processStream()} and {@code * processValue()} methods * @see #handleNormalContents(InputStream) */ public interface NormalContentsHandler<T> { /** * May or may not read from the <var>inputStream</var>, and may or may not close it. * * @see #processFile(File, Predicate, ArchiveHandler, Predicate, CompressorHandler, NormalContentsHandler) * @see CompressUtil#processStream(InputStream, Predicate, ArchiveHandler, Predicate, CompressorHandler, * NormalContentsHandler) */ @Nullable T handleNormalContents(InputStream inputStream) throws IOException; }
if (zfe.getFeature() == Feature.ENCRYPTION) { throw new EncryptedDocumentException(zfe);
if (zfe.getFeature() == Feature.ENCRYPTION) { throw new EncryptedDocumentException(zfe);
if (zfe.getFeature() == Feature.ENCRYPTION) { throw new EncryptedDocumentException(zfe);
/** * Fills the given array with the first local file header and * deals with splitting/spanning markers that may prefix the first * LFH. */ private void readFirstLocalFileHeader(final byte[] lfh) throws IOException { readFully(lfh); final ZipLong sig = new ZipLong(lfh); if (sig.equals(ZipLong.DD_SIG)) { throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException.Feature.SPLITTING); } if (sig.equals(ZipLong.SINGLE_SEGMENT_SPLIT_MARKER)) { // The archive is not really split as only one segment was // needed in the end. Just skip over the marker. final byte[] missedLfhBytes = new byte[4]; readFully(missedLfhBytes); System.arraycopy(lfh, 4, lfh, 0, LFH_LEN - 4); System.arraycopy(missedLfhBytes, 0, lfh, LFH_LEN - 4, 4); } }
throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException.Feature.DATA_DESCRIPTOR, current.entry); throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException.Feature.UNKNOWN_COMPRESSED_SIZE, current.entry); read = current.in.read(buffer, offset, length); } else { throw new UnsupportedZipFeatureException(ZipMethod.getMethodByCode(current.entry.getMethod()), current.entry);
/** * Checks whether the entry requires features not (yet) supported * by the library and throws an exception if it does. */ static void checkRequestedFeatures(final ZipArchiveEntry ze) throws UnsupportedZipFeatureException { if (!supportsEncryptionOf(ze)) { throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException .Feature.ENCRYPTION, ze); } if (!supportsMethodOf(ze)) { final ZipMethod m = ZipMethod.getMethodByCode(ze.getMethod()); if (m == null) { throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException .Feature.METHOD, ze); } throw new UnsupportedZipFeatureException(m, ze); } } }
/** * Fills the given array with the first local file header and * deals with splitting/spanning markers that may prefix the first * LFH. */ private void readFirstLocalFileHeader(final byte[] lfh) throws IOException { readFully(lfh); final ZipLong sig = new ZipLong(lfh); if (sig.equals(ZipLong.DD_SIG)) { throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException.Feature.SPLITTING); } if (sig.equals(ZipLong.SINGLE_SEGMENT_SPLIT_MARKER)) { // The archive is not really split as only one segment was // needed in the end. Just skip over the marker. final byte[] missedLfhBytes = new byte[4]; readFully(missedLfhBytes); System.arraycopy(lfh, 4, lfh, 0, LFH_LEN - 4); System.arraycopy(missedLfhBytes, 0, lfh, LFH_LEN - 4, 4); } }
throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException.Feature.DATA_DESCRIPTOR, current.entry); throw new UnsupportedZipFeatureException(UnsupportedZipFeatureException.Feature.UNKNOWN_COMPRESSED_SIZE, current.entry); read = current.in.read(buffer, offset, length); } else { throw new UnsupportedZipFeatureException(ZipMethod.getMethodByCode(current.entry.getMethod()), current.entry);