- java.lang.Object
-
- io.netty5.handler.codec.http2.AbstractHttp2StreamFrame
-
- io.netty5.handler.codec.http2.DefaultHttp2DataFrame
-
- All Implemented Interfaces:
Http2DataFrame,Http2Frame,Http2StreamFrame,Resource<Http2DataFrame>,AutoCloseable
@UnstableApi public final class DefaultHttp2DataFrame extends AbstractHttp2StreamFrame implements Http2DataFrame
The defaultHttp2DataFrameimplementation.
-
-
Constructor Summary
Constructors Constructor Description DefaultHttp2DataFrame(boolean endStream)Equivalent tonew DefaultHttp2DataFrame(Unpooled.EMPTY_BUFFER, endStream).DefaultHttp2DataFrame(Send<Buffer> content)Equivalent tonew DefaultHttp2DataFrame(content, false).DefaultHttp2DataFrame(Send<Buffer> content, boolean endStream)Equivalent tonew DefaultHttp2DataFrame(content, endStream, 0).DefaultHttp2DataFrame(Send<Buffer> content, boolean endStream, int padding)Construct a new data message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the resource, making it inaccessible.Buffercontent()Payload of DATA frame.DefaultHttp2DataFramecopy()Produce a copy of this data frame, which contain a copy of the frame contents.booleanequals(Object o)Returnstrueifohas equalstreamto this object.inthashCode()intinitialFlowControlledBytes()Returns the number of bytes that are flow-controlled initially, so even if theHttp2DataFrame.content()is consumed this will not change.booleanisAccessible()Check if this object is accessible.booleanisEndStream()Returnstrueif the END_STREAM flag is set.Stringname()Returns the name of the HTTP/2 frame e.g.intpadding()Frame padding to use.Send<Http2DataFrame>send()Send this object instance to another Thread, transferring the ownership to the recipient.DefaultHttp2DataFramestream(Http2FrameStream stream)Set theHttp2FrameStreamobject for this frame.StringtoString()DefaultHttp2DataFrametouch(Object hint)Record the current access location for debugging purposes.-
Methods inherited from class io.netty5.handler.codec.http2.AbstractHttp2StreamFrame
stream
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty5.handler.codec.http2.Http2StreamFrame
stream
-
-
-
-
Constructor Detail
-
DefaultHttp2DataFrame
public DefaultHttp2DataFrame(Send<Buffer> content)
Equivalent tonew DefaultHttp2DataFrame(content, false).- Parameters:
content- non-nullpayload
-
DefaultHttp2DataFrame
public DefaultHttp2DataFrame(boolean endStream)
Equivalent tonew DefaultHttp2DataFrame(Unpooled.EMPTY_BUFFER, endStream).- Parameters:
endStream- whether this data should terminate the stream
-
DefaultHttp2DataFrame
public DefaultHttp2DataFrame(Send<Buffer> content, boolean endStream)
Equivalent tonew DefaultHttp2DataFrame(content, endStream, 0).- Parameters:
content- non-nullpayloadendStream- whether this data should terminate the stream
-
DefaultHttp2DataFrame
public DefaultHttp2DataFrame(Send<Buffer> content, boolean endStream, int padding)
Construct a new data message.- Parameters:
content- non-nullpayloadendStream- whether this data should terminate the streampadding- additional bytes that should be added to obscure the true content size. Must be between 0 and 256 (inclusive).
-
-
Method Detail
-
stream
public DefaultHttp2DataFrame stream(Http2FrameStream stream)
Description copied from interface:Http2StreamFrameSet theHttp2FrameStreamobject for this frame.- Specified by:
streamin interfaceHttp2StreamFrame- Overrides:
streamin classAbstractHttp2StreamFrame
-
name
public String name()
Description copied from interface:Http2FrameReturns the name of the HTTP/2 frame e.g. DATA, GOAWAY, etc.- Specified by:
namein interfaceHttp2Frame
-
isEndStream
public boolean isEndStream()
Description copied from interface:Http2DataFrameReturnstrueif the END_STREAM flag is set.- Specified by:
isEndStreamin interfaceHttp2DataFrame
-
padding
public int padding()
Description copied from interface:Http2DataFrameFrame padding to use. Will be non-negative and less than 256.- Specified by:
paddingin interfaceHttp2DataFrame
-
content
public Buffer content()
Description copied from interface:Http2DataFramePayload of DATA frame. Will not benull.- Specified by:
contentin interfaceHttp2DataFrame
-
initialFlowControlledBytes
public int initialFlowControlledBytes()
Description copied from interface:Http2DataFrameReturns the number of bytes that are flow-controlled initially, so even if theHttp2DataFrame.content()is consumed this will not change.- Specified by:
initialFlowControlledBytesin interfaceHttp2DataFrame
-
copy
public DefaultHttp2DataFrame copy()
Description copied from interface:Http2DataFrameProduce a copy of this data frame, which contain a copy of the frame contents.- Specified by:
copyin interfaceHttp2DataFrame- Returns:
- A copy of this data frame.
-
send
public Send<Http2DataFrame> send()
Description copied from interface:ResourceSend this object instance to another Thread, transferring the ownership to the recipient.The object must be in a state where it can be sent, which includes at least being accessible.
When sent, this instance will immediately become inaccessible, as if by closing it. All attempts at accessing an object that has been sent, even if that object has not yet been received, should cause an exception to be thrown.
Calling
Resource.close()on an object that has been sent will have no effect, so this method is safe to call within a try-with-resources statement.- Specified by:
sendin interfaceResource<Http2DataFrame>
-
close
public void close()
Description copied from interface:ResourceClose the resource, making it inaccessible.Note, this method is not thread-safe unless otherwise specified.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceResource<Http2DataFrame>
-
isAccessible
public boolean isAccessible()
Description copied from interface:ResourceCheck if this object is accessible.- Specified by:
isAccessiblein interfaceResource<Http2DataFrame>- Returns:
trueif this object is still valid and can be accessed, otherwisefalseif, for instance, this object has been dropped/deallocated, or been sent elsewhere.
-
touch
public DefaultHttp2DataFrame touch(Object hint)
Description copied from interface:ResourceRecord the current access location for debugging purposes. This information may be included if the resource throws a life-cycle related exception, or if it leaks. If this resource has already been closed, then this method has no effect.- Specified by:
touchin interfaceResource<Http2DataFrame>- Parameters:
hint- An optional hint about this access and its context. May benull.- Returns:
- This resource instance.
-
equals
public boolean equals(Object o)
Description copied from class:AbstractHttp2StreamFrameReturnstrueifohas equalstreamto this object.- Overrides:
equalsin classAbstractHttp2StreamFrame
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractHttp2StreamFrame
-
-