decompress() — netty Function Reference
Architecture documentation for the decompress() function in FastLz.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 95dcc9e7_c527_0c24_1626_72062722dde1["decompress()"] 98671d94_5a6d_343c_6d73_292cd19cfd19["FastLz"] 95dcc9e7_c527_0c24_1626_72062722dde1 -->|defined in| 98671d94_5a6d_343c_6d73_292cd19cfd19 style 95dcc9e7_c527_0c24_1626_72062722dde1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/FastLz.java lines 409–543
static int decompress(final ByteBuf input, final int inOffset, final int inLength,
final ByteBuf output, final int outOffset, final int outLength) {
//int level = ((*(const flzuint8*)input) >> 5) + 1;
final int level = (input.getByte(inOffset) >> 5) + 1;
if (level != LEVEL_1 && level != LEVEL_2) {
throw new DecompressionException(String.format(
"invalid level: %d (expected: %d or %d)", level, LEVEL_1, LEVEL_2
));
}
// const flzuint8* ip = (const flzuint8*) input;
int ip = 0;
// flzuint8* op = (flzuint8*) output;
int op = 0;
// flzuint32 ctrl = (*ip++) & 31;
long ctrl = input.getByte(inOffset + ip++) & 31;
int loop = 1;
do {
// const flzuint8* ref = op;
int ref = op;
// flzuint32 len = ctrl >> 5;
long len = ctrl >> 5;
// flzuint32 ofs = (ctrl & 31) << 8;
long ofs = (ctrl & 31) << 8;
if (ctrl >= 32) {
len--;
// ref -= ofs;
ref -= ofs;
int code;
if (len == 6) {
if (level == LEVEL_1) {
// len += *ip++;
len += input.getUnsignedByte(inOffset + ip++);
} else {
do {
code = input.getUnsignedByte(inOffset + ip++);
len += code;
} while (code == 255);
}
}
if (level == LEVEL_1) {
// ref -= *ip++;
ref -= input.getUnsignedByte(inOffset + ip++);
} else {
code = input.getUnsignedByte(inOffset + ip++);
ref -= code;
/* match from 16-bit distance */
// if(FASTLZ_UNEXPECT_CONDITIONAL(code==255))
// if(FASTLZ_EXPECT_CONDITIONAL(ofs==(31 << 8)))
if (code == 255 && ofs == 31 << 8) {
ofs = input.getUnsignedByte(inOffset + ip++) << 8;
ofs += input.getUnsignedByte(inOffset + ip++);
ref = (int) (op - ofs - MAX_DISTANCE);
}
}
// if the output index + length of block(?) + 3(?) is over the output limit?
if (op + len + 3 > outLength) {
return 0;
}
// if (FASTLZ_UNEXPECT_CONDITIONAL(ref-1 < (flzuint8 *)output))
// if the address space of ref-1 is < the address of output?
// if we are still at the beginning of the output address?
if (ref - 1 < 0) {
return 0;
}
if (ip < inLength) {
ctrl = input.getUnsignedByte(inOffset + ip++);
} else {
loop = 0;
}
if (ref == op) {
/* optimize copy for a run */
Domain
Subdomains
Source
Frequently Asked Questions
What does decompress() do?
decompress() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/FastLz.java.
Where is decompress() defined?
decompress() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/FastLz.java at line 409.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free