Package net.mcbrawls.inject.http
Class HttpByteBuf
java.lang.Object
net.mcbrawls.inject.http.HttpByteBuf
A custom ByteBuf used for sending HTTP responses using HttpInterceptor.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpByteBufhttpBuf(io.netty.channel.ChannelHandlerContext ctx) Creates a newHttpByteBufbased off aChannelHandlerContext's allocator.io.netty.buffer.ByteBufinner()voidwriteBytes(byte[] bytes) Writes a byte array to the buffer.voidwriteHeader(String header, String value) Writes an HTTP header to the buffer.voidwriteStatusLine(String protocolVersion, int statusCode, String statusMessage) Writes the status line to the buffer.voidWrites text to the buffer.
-
Constructor Details
-
HttpByteBuf
public HttpByteBuf(io.netty.buffer.ByteBuf inner)
-
-
Method Details
-
writeStatusLine
Writes the status line to the buffer. Format is as following: HTTP/{protocolVersion} {statusCode} {statusMessage} \n -
writeHeader
Writes an HTTP header to the buffer. -
writeText
Writes text to the buffer. -
writeBytes
public void writeBytes(byte[] bytes) Writes a byte array to the buffer. -
inner
public io.netty.buffer.ByteBuf inner()- Returns:
- the inner byte buf
-
httpBuf
Creates a newHttpByteBufbased off aChannelHandlerContext's allocator.- Parameters:
ctx- the context- Returns:
- the HTTP byte buf
-