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
The default
Http2DataFrame
implementation.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBuf
private final boolean
private final int
private final int
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttp2DataFrame
(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
Modifier and TypeMethodDescriptioncontent()
Payload of DATA frame.copy()
Creates a deep copy of thisByteBufHolder
.Duplicates thisByteBufHolder
.boolean
Returnstrue
ifo
has equalstream
to this object.int
hashCode()
int
Returns the number of bytes that are flow-controlled initially, so even if theHttp2DataFrame.content()
is consumed this will not change.boolean
Returnstrue
if the END_STREAM flag is set.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
.Returns a newByteBufHolder
which contains the specifiedcontent
.retain()
Increases the reference count by1
.retain
(int increment) Increases the reference count by the specifiedincrement
.Duplicates thisByteBufHolder
.stream
(Http2FrameStream stream) Set theHttp2FrameStream
object for this frame.toString()
touch()
Records the current access location of this object for debugging purposes.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
-
Field Details
-
-
endStream
private final boolean endStream -
padding
private final int padding -
initialFlowControlledBytes
private final int initialFlowControlledBytes
-
-
Constructor Details
-
DefaultHttp2DataFrame
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
Equivalent tonew DefaultHttp2DataFrame(content, endStream, 0)
.- Parameters:
content
- non-null
payloadendStream
- whether this data should terminate the stream
-
DefaultHttp2DataFrame
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 Details
-
stream
Description copied from interface:Http2StreamFrame
Set theHttp2FrameStream
object for this frame.- Specified by:
stream
in interfaceHttp2StreamFrame
- Overrides:
stream
in classAbstractHttp2StreamFrame
-
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
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
Description copied from interface:ByteBufHolder
Creates a deep copy of thisByteBufHolder
.- Specified by:
copy
in interfaceByteBufHolder
- Specified by:
copy
in interfaceHttp2DataFrame
-
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
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:
-
replace
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
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
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
-
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
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
Description copied from class:AbstractHttp2StreamFrame
Returnstrue
ifo
has equalstream
to this object.- Overrides:
equals
in classAbstractHttp2StreamFrame
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractHttp2StreamFrame
-