…lines 1–26 unchanged (26 lines)
27
28/**
29 * Deflate decompressor.
30 * @since 1.9
31 */
32public class DeflateCompressorInputStream extends CompressorInputStream {
33 private static final int MAGIC_1 = 0x78;
34 private static final int MAGIC_2a = 0x01;
35 private static final int MAGIC_2b = 0x5e;
36 private static final int MAGIC_2c = 0x9c;
37 private static final int MAGIC_2d = 0xda;
38
39 private final InputStream in;
40
41 /**
42 * Creates a new input stream that decompresses Deflate-compressed data
43 * from the specified input stream.
…lines 44–104 unchanged (61 lines)
105 * the number of bytes to check
106 * @return true, if this stream is zlib / deflate compressed with a header
107 * stream, false otherwise
108 *
109 * @since 1.9
110 */
111 public static boolean matches(byte[] signature, int length) {
112 return length > 3 && signature[0] == MAGIC_1 && (
113 signature[1] == (byte) MAGIC_2a ||
114 signature[1] == (byte) MAGIC_2b ||
115 signature[1] == (byte) MAGIC_2c ||
116 signature[1] == (byte) MAGIC_2d);
117 }
118}
119