GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Codec-compression: Add Snappy frame decompressor by yawkat · Pull Request #17153 · netty/netty

Codec-compression: Add Snappy frame decompressor #17153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
chrisvest merged 3 commits into 4.2 from snappy-frame-decompressor
Jul 28, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Codec-compression: Add Snappy frame decompressor #17153

Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
80753ae
Codec-compression: Add Snappy frame decompressor
yawkat Jul 27, 2026
65896c7
Codec-compression: Test Snappy decompressor checksums
yawkat Jul 27, 2026
6ee957a
Address comment
chrisvest Jul 27, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
Codec-compression: Test Snappy decompressor checksums
Co-Authored-By: multicode <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@yawkat @multicode-agent
yawkat and multicode-agent committed Jul 27, 2026
commit 65896c74346a1a5db7a66bb23de1ba10673d146d

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

61 changes: 61 additions & 0 deletions 61 ...-compression/src/test/java/io/netty/handler/codec/compression/SnappyDecompressorTest.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,42 @@ public void testUncompressedDataWithTooShortChunkLengthThrowsException(
assertInvalidChunkLength(validateChecksums, (byte) 0x01, chunkLength);
}

@Test
public void testInvalidChecksumThrowsException() throws Exception {
try (Decompressor decompressor = SnappyFrameDecompressor.builder()
.validateChecksums(true).build(ByteBufAllocator.DEFAULT)) {
ByteBuf in = uncompressedDataWithChecksum(0, 0, 0, 0);

assertEquals(Decompressor.Status.NEED_INPUT, decompressor.status());
assertThrows(DecompressionException.class, () -> decompressor.addInput(in));
}
}

@Test
public void testValidChecksumProducesOutput() throws Exception {
try (Decompressor decompressor = SnappyFrameDecompressor.builder()
.validateChecksums(true).build(ByteBufAllocator.DEFAULT)) {
ByteBuf in = uncompressedDataWithChecksum(0x6f, -0x68, 0x2e, -0x47);

assertEquals(Decompressor.Status.NEED_INPUT, decompressor.status());
decompressor.addInput(in);
assertEquals(Decompressor.Status.NEED_OUTPUT, decompressor.status());

ByteBuf expected = Unpooled.wrappedBuffer(new byte[] { 'n', 'e', 't', 't', 'y' });
ByteBuf actual = decompressor.takeOutput();
try {
assertEquals(expected, actual);
} finally {
expected.release();
actual.release();
}

assertEquals(Decompressor.Status.NEED_INPUT, decompressor.status());
decompressor.endOfInput();
assertEquals(Decompressor.Status.COMPLETE, decompressor.status());
}
}

@Test
public void testEndOfInputWithPartialFrameHeaderThrowsException() throws Exception {
assertTruncated(Unpooled.wrappedBuffer(new byte[] { (byte) 0xff, 0x06 }));
Expand Down Expand Up @@ -109,6 +145,31 @@ private static void assertInvalidChunkLength(boolean validateChecksums, byte chu
}
}

private static ByteBuf uncompressedDataWithChecksum(int checksumByte1, int checksumByte2,
int checksumByte3, int checksumByte4) {
ByteBuf in = ByteBufAllocator.DEFAULT.buffer(23);
in.writeByte(0xff);
in.writeMediumLE(6);
in.writeByte('s');
in.writeByte('N');
in.writeByte('a');
in.writeByte('P');
in.writeByte('p');
in.writeByte('Y');
in.writeByte(0x01);
in.writeMediumLE(9);
in.writeByte(checksumByte1);
in.writeByte(checksumByte2);
in.writeByte(checksumByte3);
in.writeByte(checksumByte4);
in.writeByte('n');
in.writeByte('e');
in.writeByte('t');
in.writeByte('t');
in.writeByte('y');
return in;
}

private static void assertTruncated(ByteBuf in) throws Exception {
try (Decompressor decompressor = SnappyFrameDecompressor.builder().build(ByteBufAllocator.DEFAULT)) {
assertEquals(Decompressor.Status.NEED_INPUT, decompressor.status());
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.