testWrapMemoryMapped() — netty Function Reference
Architecture documentation for the testWrapMemoryMapped() function in ReadOnlyDirectByteBufferBufTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 88213226_3fde_e35e_060c_2c7ce6b5c7f8["testWrapMemoryMapped()"] 2436e747_1306_235e_86df_d12765b22d51["ReadOnlyDirectByteBufferBufTest"] 88213226_3fde_e35e_060c_2c7ce6b5c7f8 -->|defined in| 2436e747_1306_235e_86df_d12765b22d51 style 88213226_3fde_e35e_060c_2c7ce6b5c7f8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/test/java/io/netty/buffer/ReadOnlyDirectByteBufferBufTest.java lines 383–424
@Test
public void testWrapMemoryMapped() throws Exception {
File file = PlatformDependent.createTempFile("netty-test", "tmp", null);
FileChannel output = null;
FileChannel input = null;
ByteBuf b1 = null;
ByteBuf b2 = null;
try {
output = new RandomAccessFile(file, "rw").getChannel();
byte[] bytes = new byte[1024];
ThreadLocalRandom.current().nextBytes(bytes);
output.write(ByteBuffer.wrap(bytes));
input = new RandomAccessFile(file, "r").getChannel();
ByteBuffer m = input.map(FileChannel.MapMode.READ_ONLY, 0, input.size());
b1 = buffer(m);
ByteBuffer dup = m.duplicate();
dup.position(2);
dup.limit(4);
b2 = buffer(dup);
assertEquals(b2, b1.slice(2, 2));
} finally {
if (b1 != null) {
b1.release();
}
if (b2 != null) {
b2.release();
}
if (output != null) {
output.close();
}
if (input != null) {
input.close();
}
file.delete();
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testWrapMemoryMapped() do?
testWrapMemoryMapped() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/ReadOnlyDirectByteBufferBufTest.java.
Where is testWrapMemoryMapped() defined?
testWrapMemoryMapped() is defined in buffer/src/test/java/io/netty/buffer/ReadOnlyDirectByteBufferBufTest.java at line 383.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free