public class DefaultByteBufHolder extends Object implements ByteBufHolder
ByteBufHolder
that holds it's data in a ByteBuf
.Constructor and Description |
---|
DefaultByteBufHolder(ByteBuf data) |
Modifier and Type | Method and Description |
---|---|
ByteBuf |
content()
Return the data which is held by this
ByteBufHolder . |
protected String |
contentToString()
Return
ByteBuf.toString() without checking the reference count first. |
ByteBufHolder |
copy()
Creates a deep copy of this
ByteBufHolder . |
ByteBufHolder |
duplicate()
Duplicates this
ByteBufHolder . |
boolean |
equals(Object o) |
int |
hashCode() |
int |
refCnt()
Returns the reference count of this object.
|
boolean |
release()
Decreases the reference count by
1 and deallocates this object if the reference count reaches at
0 . |
boolean |
release(int decrement)
Decreases the reference count by the specified
decrement and deallocates this object if the reference
count reaches at 0 . |
ByteBufHolder |
replace(ByteBuf content)
Returns a new
ByteBufHolder which contains the specified content . |
ByteBufHolder |
retain()
Increases the reference count by
1 . |
ByteBufHolder |
retain(int increment)
Increases the reference count by the specified
increment . |
ByteBufHolder |
retainedDuplicate()
Duplicates this
ByteBufHolder . |
String |
toString() |
ByteBufHolder |
touch()
Records the current access location of this object for debugging purposes.
|
ByteBufHolder |
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
public DefaultByteBufHolder(ByteBuf data)
public ByteBuf content()
ByteBufHolder
ByteBufHolder
.content
in interface ByteBufHolder
public ByteBufHolder copy()
ByteBufHolder
.
This method calls replace(content().copy())
by default.
copy
in interface ByteBufHolder
public ByteBufHolder duplicate()
ByteBufHolder
. Be aware that this will not automatically call ByteBufHolder.retain()
.
This method calls replace(content().duplicate())
by default.
duplicate
in interface ByteBufHolder
public ByteBufHolder retainedDuplicate()
ByteBufHolder
. This method returns a retained duplicate unlike ByteBufHolder.duplicate()
.
This method calls replace(content().retainedDuplicate())
by default.
retainedDuplicate
in interface ByteBufHolder
ByteBuf.retainedDuplicate()
public ByteBufHolder replace(ByteBuf content)
ByteBufHolder
which contains the specified content
.
Override this method to return a new instance of this object whose content is set to the specified
content
. The default implementation of copy()
, duplicate()
and
retainedDuplicate()
invokes this method to create a copy.
replace
in interface ByteBufHolder
public int refCnt()
ReferenceCounted
0
, it means this object has been deallocated.refCnt
in interface ReferenceCounted
public ByteBufHolder retain()
ReferenceCounted
1
.retain
in interface ByteBufHolder
retain
in interface ReferenceCounted
public ByteBufHolder retain(int increment)
ReferenceCounted
increment
.retain
in interface ByteBufHolder
retain
in interface ReferenceCounted
public ByteBufHolder touch()
ReferenceCounted
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
in interface ByteBufHolder
touch
in interface ReferenceCounted
public ByteBufHolder touch(Object hint)
ReferenceCounted
ResourceLeakDetector
.touch
in interface ByteBufHolder
touch
in interface ReferenceCounted
public boolean release()
ReferenceCounted
1
and deallocates this object if the reference count reaches at
0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedpublic boolean release(int decrement)
ReferenceCounted
decrement
and deallocates this object if the reference
count reaches at 0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedprotected final String contentToString()
ByteBuf.toString()
without checking the reference count first. This is useful to implement
toString()
.Copyright © 2008–2017 The Netty Project. All rights reserved.