- 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 defaultHttp2DataFrame
implementation.
-
-
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 void
close()
Close the resource, making it inaccessible.Buffer
content()
Payload of DATA frame.DefaultHttp2DataFrame
copy()
Produce a copy of this data frame, which contain a copy of the frame contents.boolean
equals(Object o)
Returnstrue
ifo
has equalstream
to this object.int
hashCode()
int
initialFlowControlledBytes()
Returns the number of bytes that are flow-controlled initially, so even if theHttp2DataFrame.content()
is consumed this will not change.boolean
isAccessible()
Check if this object is accessible.boolean
isEndStream()
Returnstrue
if the END_STREAM flag is set.String
name()
Returns the name of the HTTP/2 frame e.g.int
padding()
Frame padding to use.Send<Http2DataFrame>
send()
Send this object instance to another Thread, transferring the ownership to the recipient.DefaultHttp2DataFrame
stream(Http2FrameStream stream)
Set theHttp2FrameStream
object for this frame.String
toString()
DefaultHttp2DataFrame
touch(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-null
payload
-
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-null
payloadendStream
- 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-null
payloadendStream
- 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:Http2StreamFrame
Set theHttp2FrameStream
object for this frame.- Specified by:
stream
in interfaceHttp2StreamFrame
- Overrides:
stream
in classAbstractHttp2StreamFrame
-
name
public String name()
Description copied from interface:Http2Frame
Returns the name of the HTTP/2 frame e.g. DATA, GOAWAY, etc.- Specified by:
name
in interfaceHttp2Frame
-
isEndStream
public boolean isEndStream()
Description copied from interface:Http2DataFrame
Returnstrue
if the END_STREAM flag is set.- Specified by:
isEndStream
in interfaceHttp2DataFrame
-
padding
public int padding()
Description copied from interface:Http2DataFrame
Frame padding to use. Will be non-negative and less than 256.- Specified by:
padding
in interfaceHttp2DataFrame
-
content
public Buffer content()
Description copied from interface:Http2DataFrame
Payload of DATA frame. Will not benull
.- Specified by:
content
in interfaceHttp2DataFrame
-
initialFlowControlledBytes
public int initialFlowControlledBytes()
Description copied from interface:Http2DataFrame
Returns the number of bytes that are flow-controlled initially, so even if theHttp2DataFrame.content()
is consumed this will not change.- Specified by:
initialFlowControlledBytes
in interfaceHttp2DataFrame
-
copy
public DefaultHttp2DataFrame copy()
Description copied from interface:Http2DataFrame
Produce a copy of this data frame, which contain a copy of the frame contents.- Specified by:
copy
in interfaceHttp2DataFrame
- Returns:
- A copy of this data frame.
-
send
public Send<Http2DataFrame> send()
Description copied from interface:Resource
Send 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:
send
in interfaceResource<Http2DataFrame>
-
close
public void close()
Description copied from interface:Resource
Close the resource, making it inaccessible.Note, this method is not thread-safe unless otherwise specified.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResource<Http2DataFrame>
-
isAccessible
public boolean isAccessible()
Description copied from interface:Resource
Check if this object is accessible.- Specified by:
isAccessible
in interfaceResource<Http2DataFrame>
- Returns:
true
if this object is still valid and can be accessed, otherwisefalse
if, for instance, this object has been dropped/deallocated, or been sent elsewhere.
-
touch
public DefaultHttp2DataFrame touch(Object hint)
Description copied from interface:Resource
Record 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:
touch
in 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:AbstractHttp2StreamFrame
Returnstrue
ifo
has equalstream
to this object.- Overrides:
equals
in classAbstractHttp2StreamFrame
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractHttp2StreamFrame
-
-