UnreleasableByteBuf Class — netty Architecture
Architecture documentation for the UnreleasableByteBuf class in UnreleasableByteBuf.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 54be67c0_7429_005c_f776_e5a3c5d7460c["UnreleasableByteBuf"] a9ada411_318f_df41_8d93_676e65bba780["UnreleasableByteBuf.java"] 54be67c0_7429_005c_f776_e5a3c5d7460c -->|defined in| a9ada411_318f_df41_8d93_676e65bba780 bb73e4d5_34e4_2f96_3963_a6871c51def6["UnreleasableByteBuf()"] 54be67c0_7429_005c_f776_e5a3c5d7460c -->|method| bb73e4d5_34e4_2f96_3963_a6871c51def6 f773fbaa_921b_6fcc_56f8_f3fe6c7d3920["ByteBuf()"] 54be67c0_7429_005c_f776_e5a3c5d7460c -->|method| f773fbaa_921b_6fcc_56f8_f3fe6c7d3920 9d3aa222_0ad2_d51e_42f6_3ab178438246["release()"] 54be67c0_7429_005c_f776_e5a3c5d7460c -->|method| 9d3aa222_0ad2_d51e_42f6_3ab178438246
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/UnreleasableByteBuf.java lines 26–133
final class UnreleasableByteBuf extends WrappedByteBuf {
private SwappedByteBuf swappedBuf;
UnreleasableByteBuf(ByteBuf buf) {
super(buf instanceof UnreleasableByteBuf ? buf.unwrap() : buf);
}
@Override
public ByteBuf order(ByteOrder endianness) {
if (ObjectUtil.checkNotNull(endianness, "endianness") == order()) {
return this;
}
SwappedByteBuf swappedBuf = this.swappedBuf;
if (swappedBuf == null) {
this.swappedBuf = swappedBuf = new SwappedByteBuf(this);
}
return swappedBuf;
}
@Override
public ByteBuf asReadOnly() {
return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly());
}
@Override
public ByteBuf readSlice(int length) {
return new UnreleasableByteBuf(buf.readSlice(length));
}
@Override
public ByteBuf readRetainedSlice(int length) {
// We could call buf.readSlice(..), and then call buf.release(). However this creates a leak in unit tests
// because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up.
// So we just use readSlice(..) because the end result should be logically equivalent.
return readSlice(length);
}
@Override
public ByteBuf slice() {
return new UnreleasableByteBuf(buf.slice());
}
@Override
public ByteBuf retainedSlice() {
// We could call buf.retainedSlice(), and then call buf.release(). However this creates a leak in unit tests
// because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up.
// So we just use slice() because the end result should be logically equivalent.
return slice();
}
@Override
public ByteBuf slice(int index, int length) {
return new UnreleasableByteBuf(buf.slice(index, length));
}
@Override
public ByteBuf retainedSlice(int index, int length) {
// We could call buf.retainedSlice(..), and then call buf.release(). However this creates a leak in unit tests
// because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up.
// So we just use slice(..) because the end result should be logically equivalent.
return slice(index, length);
}
@Override
public ByteBuf duplicate() {
return new UnreleasableByteBuf(buf.duplicate());
}
@Override
public ByteBuf retainedDuplicate() {
// We could call buf.retainedDuplicate(), and then call buf.release(). However this creates a leak in unit tests
// because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up.
// So we just use duplicate() because the end result should be logically equivalent.
return duplicate();
}
@Override
public ByteBuf retain(int increment) {
return this;
Source
Frequently Asked Questions
What is the UnreleasableByteBuf class?
UnreleasableByteBuf is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/UnreleasableByteBuf.java.
Where is UnreleasableByteBuf defined?
UnreleasableByteBuf is defined in buffer/src/main/java/io/netty/buffer/UnreleasableByteBuf.java at line 26.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free