Package io.netty.handler.codec.http2
Class DefaultHttp2DataFrame
- java.lang.Object
-
- io.netty.handler.codec.http2.AbstractHttp2StreamFrame
-
- io.netty.handler.codec.http2.DefaultHttp2DataFrame
-
- All Implemented Interfaces:
ByteBufHolder
,Http2DataFrame
,Http2Frame
,Http2StreamFrame
,ReferenceCounted
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(ByteBuf content)
Equivalent tonew DefaultHttp2DataFrame(content, false)
.DefaultHttp2DataFrame(ByteBuf content, boolean endStream)
Equivalent tonew DefaultHttp2DataFrame(content, endStream, 0)
.DefaultHttp2DataFrame(ByteBuf content, boolean endStream, int padding)
Construct a new data message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuf
content()
Payload of DATA frame.DefaultHttp2DataFrame
copy()
Creates a deep copy of thisByteBufHolder
.DefaultHttp2DataFrame
duplicate()
Duplicates thisByteBufHolder
.boolean
equals(java.lang.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
isEndStream()
Returnstrue
if the END_STREAM flag is set.java.lang.String
name()
Returns the name of the HTTP/2 frame e.g.int
padding()
Frame padding to use.int
refCnt()
Returns the reference count of this object.boolean
release()
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.boolean
release(int decrement)
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.DefaultHttp2DataFrame
replace(ByteBuf content)
Returns a newByteBufHolder
which contains the specifiedcontent
.DefaultHttp2DataFrame
retain()
Increases the reference count by1
.DefaultHttp2DataFrame
retain(int increment)
Increases the reference count by the specifiedincrement
.DefaultHttp2DataFrame
retainedDuplicate()
Duplicates thisByteBufHolder
.DefaultHttp2DataFrame
stream(Http2FrameStream stream)
Set theHttp2FrameStream
object for this frame.java.lang.String
toString()
DefaultHttp2DataFrame
touch()
Records the current access location of this object for debugging purposes.DefaultHttp2DataFrame
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.-
Methods inherited from class io.netty.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.netty.handler.codec.http2.Http2StreamFrame
stream
-
-
-
-
Constructor Detail
-
DefaultHttp2DataFrame
public DefaultHttp2DataFrame(ByteBuf 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(ByteBuf content, boolean endStream)
Equivalent tonew DefaultHttp2DataFrame(content, endStream, 0)
.- Parameters:
content
- non-null
payloadendStream
- whether this data should terminate the stream
-
DefaultHttp2DataFrame
public DefaultHttp2DataFrame(ByteBuf 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 java.lang.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 ByteBuf content()
Description copied from interface:Http2DataFrame
Payload of DATA frame. Will not benull
.- Specified by:
content
in interfaceByteBufHolder
- 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:ByteBufHolder
Creates a deep copy of thisByteBufHolder
.- Specified by:
copy
in interfaceByteBufHolder
- Specified by:
copy
in interfaceHttp2DataFrame
-
duplicate
public DefaultHttp2DataFrame duplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. Be aware that this will not automatically callByteBufHolder.retain()
.- Specified by:
duplicate
in interfaceByteBufHolder
- Specified by:
duplicate
in interfaceHttp2DataFrame
-
retainedDuplicate
public DefaultHttp2DataFrame retainedDuplicate()
Description copied from interface:ByteBufHolder
Duplicates thisByteBufHolder
. This method returns a retained duplicate unlikeByteBufHolder.duplicate()
.- Specified by:
retainedDuplicate
in interfaceByteBufHolder
- Specified by:
retainedDuplicate
in interfaceHttp2DataFrame
- See Also:
ByteBuf.retainedDuplicate()
-
replace
public DefaultHttp2DataFrame replace(ByteBuf content)
Description copied from interface:ByteBufHolder
Returns a newByteBufHolder
which contains the specifiedcontent
.- Specified by:
replace
in interfaceByteBufHolder
- Specified by:
replace
in interfaceHttp2DataFrame
-
refCnt
public int refCnt()
Description copied from interface:ReferenceCounted
Returns the reference count of this object. If0
, it means this object has been deallocated.- Specified by:
refCnt
in interfaceReferenceCounted
-
release
public boolean release()
Description copied from interface:ReferenceCounted
Decreases the reference count by1
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
release
public boolean release(int decrement)
Description copied from interface:ReferenceCounted
Decreases the reference count by the specifieddecrement
and deallocates this object if the reference count reaches at0
.- Specified by:
release
in interfaceReferenceCounted
- Returns:
true
if and only if the reference count became0
and this object has been deallocated
-
retain
public DefaultHttp2DataFrame retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceHttp2DataFrame
- Specified by:
retain
in interfaceReferenceCounted
-
retain
public DefaultHttp2DataFrame retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceHttp2DataFrame
- Specified by:
retain
in interfaceReferenceCounted
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
touch
public DefaultHttp2DataFrame touch()
Description copied from interface:ReferenceCounted
Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceHttp2DataFrame
- Specified by:
touch
in interfaceReferenceCounted
-
touch
public DefaultHttp2DataFrame touch(java.lang.Object hint)
Description copied from interface:ReferenceCounted
Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you viaResourceLeakDetector
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceHttp2DataFrame
- Specified by:
touch
in interfaceReferenceCounted
-
equals
public boolean equals(java.lang.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
-
-