AbstractByteBuf Class — netty Architecture
Architecture documentation for the AbstractByteBuf class in AbstractByteBuf.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD bbab270f_457a_3319_83a8_0a0540484666["AbstractByteBuf"] b339dcb9_8f6b_7444_2858_b6c0750c90f2["AbstractByteBuf.java"] bbab270f_457a_3319_83a8_0a0540484666 -->|defined in| b339dcb9_8f6b_7444_2858_b6c0750c90f2 25d77b6c_7141_6542_05fb_20af127b7e2b["AbstractByteBuf()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 25d77b6c_7141_6542_05fb_20af127b7e2b 6e4873f1_61cc_db4b_ceb4_982f918234a8["isReadOnly()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 6e4873f1_61cc_db4b_ceb4_982f918234a8 e9e1f861_5813_ec75_8a61_6b29c497ac9f["ByteBuf()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| e9e1f861_5813_ec75_8a61_6b29c497ac9f f4e37074_4ad7_6a4d_b116_3b334abcf18d["maxCapacity()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| f4e37074_4ad7_6a4d_b116_3b334abcf18d e34ed3b7_d7f4_5f98_9b6d_87d59cdaec5a["readerIndex()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| e34ed3b7_d7f4_5f98_9b6d_87d59cdaec5a 178d0cb9_a281_7046_35b1_0dbfaffe6b93["checkIndexBounds()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 178d0cb9_a281_7046_35b1_0dbfaffe6b93 67993e0c_3b33_e884_495b_6ad7509b65c8["writerIndex()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 67993e0c_3b33_e884_495b_6ad7509b65c8 25b04a59_1e4c_d18a_4799_924a9b6e5bb7["isReadable()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 25b04a59_1e4c_d18a_4799_924a9b6e5bb7 0b217cfa_43aa_bb32_9feb_eea8b833408e["isWritable()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 0b217cfa_43aa_bb32_9feb_eea8b833408e 209199c1_b9f8_1504_cd35_cd206a0bedd8["readableBytes()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 209199c1_b9f8_1504_cd35_cd206a0bedd8 d5493afe_8963_9c06_feb2_ed0b912eaa52["writableBytes()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| d5493afe_8963_9c06_feb2_ed0b912eaa52 f079450a_7fc6_4fc7_5d66_7f306d19f8f6["maxWritableBytes()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| f079450a_7fc6_4fc7_5d66_7f306d19f8f6 8debb33b_b041_e06a_65cb_1a0f6ac83381["adjustMarkers()"] bbab270f_457a_3319_83a8_0a0540484666 -->|method| 8debb33b_b041_e06a_65cb_1a0f6ac83381
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java lines 47–1503
public abstract class AbstractByteBuf extends ByteBuf {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(AbstractByteBuf.class);
private static final String LEGACY_PROP_CHECK_ACCESSIBLE = "io.netty.buffer.bytebuf.checkAccessible";
private static final String PROP_CHECK_ACCESSIBLE = "io.netty.buffer.checkAccessible";
static final boolean checkAccessible; // accessed from CompositeByteBuf
private static final String PROP_CHECK_BOUNDS = "io.netty.buffer.checkBounds";
private static final boolean checkBounds;
static {
if (SystemPropertyUtil.contains(PROP_CHECK_ACCESSIBLE)) {
checkAccessible = SystemPropertyUtil.getBoolean(PROP_CHECK_ACCESSIBLE, true);
} else {
checkAccessible = SystemPropertyUtil.getBoolean(LEGACY_PROP_CHECK_ACCESSIBLE, true);
}
checkBounds = SystemPropertyUtil.getBoolean(PROP_CHECK_BOUNDS, true);
if (logger.isDebugEnabled()) {
logger.debug("-D{}: {}", PROP_CHECK_ACCESSIBLE, checkAccessible);
logger.debug("-D{}: {}", PROP_CHECK_BOUNDS, checkBounds);
}
}
static final ResourceLeakDetector<ByteBuf> leakDetector =
ResourceLeakDetectorFactory.instance().newResourceLeakDetector(ByteBuf.class);
int readerIndex;
int writerIndex;
private int markedReaderIndex;
private int markedWriterIndex;
private int maxCapacity;
protected AbstractByteBuf(int maxCapacity) {
checkPositiveOrZero(maxCapacity, "maxCapacity");
this.maxCapacity = maxCapacity;
}
@Override
public boolean isReadOnly() {
return false;
}
@SuppressWarnings("deprecation")
@Override
public ByteBuf asReadOnly() {
if (isReadOnly()) {
return this;
}
return Unpooled.unmodifiableBuffer(this);
}
@Override
public int maxCapacity() {
return maxCapacity;
}
protected final void maxCapacity(int maxCapacity) {
this.maxCapacity = maxCapacity;
}
@Override
public int readerIndex() {
return readerIndex;
}
private static void checkIndexBounds(final int readerIndex, final int writerIndex, final int capacity) {
if (readerIndex < 0 || readerIndex > writerIndex || writerIndex > capacity) {
throw new IndexOutOfBoundsException(String.format(
"readerIndex: %d, writerIndex: %d (expected: 0 <= readerIndex <= writerIndex <= capacity(%d))",
readerIndex, writerIndex, capacity));
}
}
@Override
public ByteBuf readerIndex(int readerIndex) {
if (checkBounds) {
checkIndexBounds(readerIndex, writerIndex, capacity());
}
this.readerIndex = readerIndex;
return this;
}
@Override
Source
Frequently Asked Questions
What is the AbstractByteBuf class?
AbstractByteBuf is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java.
Where is AbstractByteBuf defined?
AbstractByteBuf is defined in buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java at line 47.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free