private boolean readSignature(boolean firstFrame) throws IOException { String garbageMessage = firstFrame ? "Not a LZ4 frame stream" : "LZ4 frame stream followed by garbage"; final byte[] b = new byte[4]; int read = IOUtils.readFully(in, b); count(read); if (0 == read && !firstFrame) { // good LZ4 frame and nothing after it endReached = true; return false; } if (4 != read) { throw new IOException(garbageMessage); } read = skipSkippableFrame(b); if (0 == read && !firstFrame) { // good LZ4 frame with only some skippable frames after it endReached = true; return false; } if (4 != read || !matches(b, 4)) { throw new IOException(garbageMessage); } return true; }
if (FramedLZ4CompressorInputStream.matches(signature, signatureLength)) { return LZ4_FRAMED;
private boolean readSignature(boolean firstFrame) throws IOException { String garbageMessage = firstFrame ? "Not a LZ4 frame stream" : "LZ4 frame stream followed by garbage"; final byte[] b = new byte[4]; int read = IOUtils.readFully(in, b); count(read); if (0 == read && !firstFrame) { // good LZ4 frame and nothing after it endReached = true; return false; } if (4 != read) { throw new IOException(garbageMessage); } read = skipSkippableFrame(b); if (0 == read && !firstFrame) { // good LZ4 frame with only some skippable frames after it endReached = true; return false; } if (4 != read || !matches(b, 4)) { throw new IOException(garbageMessage); } return true; }
if (FramedLZ4CompressorInputStream.matches(signature, signatureLength)) { return LZ4_FRAMED;