testIdentity() — netty Function Reference
Architecture documentation for the testIdentity() function in FastLzIntegrationTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD bc5448c9_2ea6_eb6c_0131_2ea06789651d["testIdentity()"] 9194e8b9_99f1_2202_1e46_1c89760174c5["FastLzIntegrationTest"] bc5448c9_2ea6_eb6c_0131_2ea06789651d -->|defined in| 9194e8b9_99f1_2202_1e46_1c89760174c5 style bc5448c9_2ea6_eb6c_0131_2ea06789651d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-compression/src/test/java/io/netty/handler/codec/compression/FastLzIntegrationTest.java lines 64–113
@Override // test batched flow of data
protected void testIdentity(final byte[] data, boolean heapBuffer) {
initChannels();
final ByteBuf original = heapBuffer? Unpooled.wrappedBuffer(data) :
Unpooled.directBuffer(data.length).writeBytes(data);
final CompositeByteBuf compressed = Unpooled.compositeBuffer();
final CompositeByteBuf decompressed = Unpooled.compositeBuffer();
try {
int written = 0, length = rand.nextInt(100);
while (written + length < data.length) {
ByteBuf in = Unpooled.wrappedBuffer(data, written, length);
encoder.writeOutbound(in);
written += length;
length = rand.nextInt(100);
}
ByteBuf in = Unpooled.wrappedBuffer(data, written, data.length - written);
encoder.writeOutbound(in);
encoder.finish();
ByteBuf msg;
while ((msg = encoder.readOutbound()) != null) {
compressed.addComponent(true, msg);
}
final byte[] compressedArray = new byte[compressed.readableBytes()];
compressed.readBytes(compressedArray);
written = 0;
length = rand.nextInt(100);
while (written + length < compressedArray.length) {
in = Unpooled.wrappedBuffer(compressedArray, written, length);
decoder.writeInbound(in);
written += length;
length = rand.nextInt(100);
}
in = Unpooled.wrappedBuffer(compressedArray, written, compressedArray.length - written);
decoder.writeInbound(in);
assertFalse(compressed.isReadable());
while ((msg = decoder.readInbound()) != null) {
decompressed.addComponent(true, msg);
}
assertEquals(original, decompressed);
} finally {
compressed.release();
decompressed.release();
original.release();
closeChannels();
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testIdentity() do?
testIdentity() is a function in the netty codebase, defined in codec-compression/src/test/java/io/netty/handler/codec/compression/FastLzIntegrationTest.java.
Where is testIdentity() defined?
testIdentity() is defined in codec-compression/src/test/java/io/netty/handler/codec/compression/FastLzIntegrationTest.java at line 64.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free