testSetContentFromStream() — netty Function Reference
Architecture documentation for the testSetContentFromStream() function in AbstractMemoryHttpDataTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD ef875a46_31e7_9a01_f78a_3896ddf5e359["testSetContentFromStream()"] 3b2d0623_5311_2698_e2c8_4ff0f0e583b8["AbstractMemoryHttpDataTest"] ef875a46_31e7_9a01_f78a_3896ddf5e359 -->|defined in| 3b2d0623_5311_2698_e2c8_4ff0f0e583b8 54414378_073c_cece_2b86_2b81f7995c83["TestHttpData()"] ef875a46_31e7_9a01_f78a_3896ddf5e359 -->|calls| 54414378_073c_cece_2b86_2b81f7995c83 f814f6f0_669c_ffdc_fbd3_c5111ff1fbb8["equals()"] ef875a46_31e7_9a01_f78a_3896ddf5e359 -->|calls| f814f6f0_669c_ffdc_fbd3_c5111ff1fbb8 style ef875a46_31e7_9a01_f78a_3896ddf5e359 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java lines 111–148
@Test
public void testSetContentFromStream() throws Exception {
// definedSize=0
TestHttpData test = new TestHttpData("test", UTF_8, 0);
String contentStr = "foo_test";
ByteBuf buf = Unpooled.wrappedBuffer(contentStr.getBytes(UTF_8));
buf.markReaderIndex();
try (ByteBufInputStream is = new ByteBufInputStream(buf)) {
test.setContent(is);
assertFalse(buf.isReadable());
assertEquals(contentStr, test.getString(UTF_8));
buf.resetReaderIndex();
assertTrue(ByteBufUtil.equals(buf, test.getByteBuf()));
}
Random random = new SecureRandom();
for (int i = 0; i < 20; i++) {
// Generate input data bytes.
int size = random.nextInt(Short.MAX_VALUE);
byte[] bytes = new byte[size];
random.nextBytes(bytes);
// Generate parsed HTTP data block.
TestHttpData data = new TestHttpData("name", UTF_8, 0);
data.setContent(new ByteArrayInputStream(bytes));
// Validate stored data.
ByteBuf buffer = data.getByteBuf();
assertEquals(0, buffer.readerIndex());
assertEquals(bytes.length, buffer.writerIndex());
assertArrayEquals(bytes, Arrays.copyOf(buffer.array(), bytes.length));
assertArrayEquals(bytes, data.get());
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does testSetContentFromStream() do?
testSetContentFromStream() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java.
Where is testSetContentFromStream() defined?
testSetContentFromStream() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/AbstractMemoryHttpDataTest.java at line 111.
What does testSetContentFromStream() call?
testSetContentFromStream() calls 2 function(s): TestHttpData, equals.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free