UnsafeDirectSwappedByteBuf Class — netty Architecture
Architecture documentation for the UnsafeDirectSwappedByteBuf class in UnsafeDirectSwappedByteBuf.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD f2671afe_7805_5e15_8a98_b2a46a7c2f94["UnsafeDirectSwappedByteBuf"] 9da7ff9a_20ee_2539_1405_5b05fb38ff23["UnsafeDirectSwappedByteBuf.java"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|defined in| 9da7ff9a_20ee_2539_1405_5b05fb38ff23 38227bde_bad6_67ec_83eb_aeab2f8a517c["UnsafeDirectSwappedByteBuf()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| 38227bde_bad6_67ec_83eb_aeab2f8a517c 8ddd9c65_731d_cc06_2ca2_22037363d042["addr()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| 8ddd9c65_731d_cc06_2ca2_22037363d042 578c8c50_4bc4_3b56_3cce_509987da2420["_getLong()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| 578c8c50_4bc4_3b56_3cce_509987da2420 3614900a_0ea6_ac58_251f_84176c7421c4["_getInt()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| 3614900a_0ea6_ac58_251f_84176c7421c4 b505d4d0_6bdc_7d7b_cf29_4e912ecde1b2["_getShort()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| b505d4d0_6bdc_7d7b_cf29_4e912ecde1b2 bc57c20e_e8a3_84cf_c272_c8810a8bf3db["_setShort()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| bc57c20e_e8a3_84cf_c272_c8810a8bf3db 2dbe48e4_c67a_f2e0_4b35_8851d1687ad1["_setInt()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| 2dbe48e4_c67a_f2e0_4b35_8851d1687ad1 5b79372d_5904_b347_44f0_78d11820442e["_setLong()"] f2671afe_7805_5e15_8a98_b2a46a7c2f94 -->|method| 5b79372d_5904_b347_44f0_78d11820442e
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/UnsafeDirectSwappedByteBuf.java lines 24–67
final class UnsafeDirectSwappedByteBuf extends AbstractUnsafeSwappedByteBuf {
UnsafeDirectSwappedByteBuf(AbstractByteBuf buf) {
super(buf);
}
private static long addr(AbstractByteBuf wrapped, int index) {
// We need to call wrapped.memoryAddress() everytime and NOT cache it as it may change if the buffer expand.
// See:
// - https://github.com/netty/netty/issues/2587
// - https://github.com/netty/netty/issues/2580
return wrapped.memoryAddress() + index;
}
@Override
protected long _getLong(AbstractByteBuf wrapped, int index) {
return PlatformDependent.getLong(addr(wrapped, index));
}
@Override
protected int _getInt(AbstractByteBuf wrapped, int index) {
return PlatformDependent.getInt(addr(wrapped, index));
}
@Override
protected short _getShort(AbstractByteBuf wrapped, int index) {
return PlatformDependent.getShort(addr(wrapped, index));
}
@Override
protected void _setShort(AbstractByteBuf wrapped, int index, short value) {
PlatformDependent.putShort(addr(wrapped, index), value);
}
@Override
protected void _setInt(AbstractByteBuf wrapped, int index, int value) {
PlatformDependent.putInt(addr(wrapped, index), value);
}
@Override
protected void _setLong(AbstractByteBuf wrapped, int index, long value) {
PlatformDependent.putLong(addr(wrapped, index), value);
}
}
Source
Frequently Asked Questions
What is the UnsafeDirectSwappedByteBuf class?
UnsafeDirectSwappedByteBuf is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/UnsafeDirectSwappedByteBuf.java.
Where is UnsafeDirectSwappedByteBuf defined?
UnsafeDirectSwappedByteBuf is defined in buffer/src/main/java/io/netty/buffer/UnsafeDirectSwappedByteBuf.java at line 24.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free