readGZIPHeader() — netty Function Reference
Architecture documentation for the readGZIPHeader() function in JdkZlibDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 146f8d9e_03da_37c7_3683_c470a8d21243["readGZIPHeader()"] bba68af7_04c2_8ee6_82f0_73e08fa3f9cd["JdkZlibDecoder"] 146f8d9e_03da_37c7_3683_c470a8d21243 -->|defined in| bba68af7_04c2_8ee6_82f0_73e08fa3f9cd f055bb74_306f_40f9_d9c1_85083f9dc74b["decode()"] f055bb74_306f_40f9_d9c1_85083f9dc74b -->|calls| 146f8d9e_03da_37c7_3683_c470a8d21243 7b4beb12_b4f3_449d_8418_cc7cf01135ae["skipIfNeeded()"] 146f8d9e_03da_37c7_3683_c470a8d21243 -->|calls| 7b4beb12_b4f3_449d_8418_cc7cf01135ae 0005c058_d3b6_8d94_0a7b_5b5a71fa24c4["verifyCrc16()"] 146f8d9e_03da_37c7_3683_c470a8d21243 -->|calls| 0005c058_d3b6_8d94_0a7b_5b5a71fa24c4 style 146f8d9e_03da_37c7_3683_c470a8d21243 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-compression/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java lines 343–433
private boolean readGZIPHeader(ByteBuf in) {
switch (gzipState) {
case HEADER_START:
if (in.readableBytes() < 10) {
return false;
}
// read magic numbers
int magic0 = in.readByte();
int magic1 = in.readByte();
if (magic0 != 31) {
throw new DecompressionException("Input is not in the GZIP format");
}
crc.update(magic0);
crc.update(magic1);
int method = in.readUnsignedByte();
if (method != Deflater.DEFLATED) {
throw new DecompressionException("Unsupported compression method "
+ method + " in the GZIP header");
}
crc.update(method);
flags = in.readUnsignedByte();
crc.update(flags);
if ((flags & FRESERVED) != 0) {
throw new DecompressionException(
"Reserved flags are set in the GZIP header");
}
// mtime (int)
crc.update(in, in.readerIndex(), 4);
in.skipBytes(4);
crc.update(in.readUnsignedByte()); // extra flags
crc.update(in.readUnsignedByte()); // operating system
gzipState = GzipState.FLG_READ;
// fall through
case FLG_READ:
if ((flags & FEXTRA) != 0) {
if (in.readableBytes() < 2) {
return false;
}
int xlen1 = in.readUnsignedByte();
int xlen2 = in.readUnsignedByte();
crc.update(xlen1);
crc.update(xlen2);
xlen |= xlen1 << 8 | xlen2;
}
gzipState = GzipState.XLEN_READ;
// fall through
case XLEN_READ:
if (xlen != -1) {
if (in.readableBytes() < xlen) {
return false;
}
crc.update(in, in.readerIndex(), xlen);
in.skipBytes(xlen);
}
gzipState = GzipState.SKIP_FNAME;
// fall through
case SKIP_FNAME:
if (!skipIfNeeded(in, FNAME)) {
return false;
}
gzipState = GzipState.SKIP_COMMENT;
// fall through
case SKIP_COMMENT:
if (!skipIfNeeded(in, FCOMMENT)) {
return false;
}
gzipState = GzipState.PROCESS_FHCRC;
// fall through
case PROCESS_FHCRC:
if ((flags & FHCRC) != 0) {
if (!verifyCrc16(in)) {
return false;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does readGZIPHeader() do?
readGZIPHeader() is a function in the netty codebase, defined in codec-compression/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java.
Where is readGZIPHeader() defined?
readGZIPHeader() is defined in codec-compression/src/main/java/io/netty/handler/codec/compression/JdkZlibDecoder.java at line 343.
What does readGZIPHeader() call?
readGZIPHeader() calls 2 function(s): skipIfNeeded, verifyCrc16.
What calls readGZIPHeader()?
readGZIPHeader() is called by 1 function(s): decode.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free