HttpChunkedInput Class — netty Architecture
Architecture documentation for the HttpChunkedInput class in HttpChunkedInput.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a5f00cca_ec09_3202_6271_9b90945f406d["HttpChunkedInput"] e59eac29_1c80_f06c_7754_0a4e44171dde["HttpChunkedInput.java"] a5f00cca_ec09_3202_6271_9b90945f406d -->|defined in| e59eac29_1c80_f06c_7754_0a4e44171dde 5eea0dd8_ab81_49fd_ee94_7f62fea69e1d["HttpChunkedInput()"] a5f00cca_ec09_3202_6271_9b90945f406d -->|method| 5eea0dd8_ab81_49fd_ee94_7f62fea69e1d 8f8bc09c_a0e6_6352_59fa_b3a3ed28da76["isEndOfInput()"] a5f00cca_ec09_3202_6271_9b90945f406d -->|method| 8f8bc09c_a0e6_6352_59fa_b3a3ed28da76 001ab882_2cfd_c3e8_19fb_4b8cab86fcad["close()"] a5f00cca_ec09_3202_6271_9b90945f406d -->|method| 001ab882_2cfd_c3e8_19fb_4b8cab86fcad 264c42d5_aa05_b7ca_22d0_96bb5e2d6cfe["HttpContent()"] a5f00cca_ec09_3202_6271_9b90945f406d -->|method| 264c42d5_aa05_b7ca_22d0_96bb5e2d6cfe 09317bab_ef28_4728_41c0_21c3edcbfc9e["length()"] a5f00cca_ec09_3202_6271_9b90945f406d -->|method| 09317bab_ef28_4728_41c0_21c3edcbfc9e 9f091947_b275_a1ca_54ef_7f015dec3ec7["progress()"] a5f00cca_ec09_3202_6271_9b90945f406d -->|method| 9f091947_b275_a1ca_54ef_7f015dec3ec7
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/HttpChunkedInput.java lines 43–119
public class HttpChunkedInput implements ChunkedInput<HttpContent> {
private final ChunkedInput<ByteBuf> input;
private final LastHttpContent lastHttpContent;
private boolean sentLastChunk;
/**
* Creates a new instance using the specified input.
* @param input {@link ChunkedInput} containing data to write
*/
public HttpChunkedInput(ChunkedInput<ByteBuf> input) {
this.input = input;
lastHttpContent = LastHttpContent.EMPTY_LAST_CONTENT;
}
/**
* Creates a new instance using the specified input. {@code lastHttpContent} will be written as the terminating
* chunk.
* @param input {@link ChunkedInput} containing data to write
* @param lastHttpContent {@link LastHttpContent} that will be written as the terminating chunk. Use this for
* training headers.
*/
public HttpChunkedInput(ChunkedInput<ByteBuf> input, LastHttpContent lastHttpContent) {
this.input = input;
this.lastHttpContent = lastHttpContent;
}
@Override
public boolean isEndOfInput() throws Exception {
if (input.isEndOfInput()) {
// Only end of input after last HTTP chunk has been sent
return sentLastChunk;
} else {
return false;
}
}
@Override
public void close() throws Exception {
input.close();
}
@Deprecated
@Override
public HttpContent readChunk(ChannelHandlerContext ctx) throws Exception {
return readChunk(ctx.alloc());
}
@Override
public HttpContent readChunk(ByteBufAllocator allocator) throws Exception {
if (input.isEndOfInput()) {
if (sentLastChunk) {
return null;
} else {
// Send last chunk for this input
sentLastChunk = true;
return lastHttpContent;
}
} else {
ByteBuf buf = input.readChunk(allocator);
if (buf == null) {
return null;
}
return new DefaultHttpContent(buf);
}
}
@Override
public long length() {
return input.length();
}
@Override
public long progress() {
return input.progress();
}
}
Source
Frequently Asked Questions
What is the HttpChunkedInput class?
HttpChunkedInput is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpChunkedInput.java.
Where is HttpChunkedInput defined?
HttpChunkedInput is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpChunkedInput.java at line 43.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free