spliceToFile() — netty Function Reference
Architecture documentation for the spliceToFile() function in EpollSpliceTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 2dcc30d5_c6fe_f528_898f_71300c6378d2["spliceToFile()"] 5f8d22b4_e4e5_93ca_78b8_9defb1460f42["EpollSpliceTest"] 2dcc30d5_c6fe_f528_898f_71300c6378d2 -->|defined in| 5f8d22b4_e4e5_93ca_78b8_9defb1460f42 b0a43897_35a9_6c9b_99ea_6e8326e77be4["SpliceHandler()"] 2dcc30d5_c6fe_f528_898f_71300c6378d2 -->|calls| b0a43897_35a9_6c9b_99ea_6e8326e77be4 style 2dcc30d5_c6fe_f528_898f_71300c6378d2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSpliceTest.java lines 188–237
@Test
@Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
public void spliceToFile() throws Throwable {
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, EpollIoHandler.newFactory());
File file = PlatformDependent.createTempFile("netty-splice", null, null);
file.deleteOnExit();
SpliceHandler sh = new SpliceHandler(file);
ServerBootstrap bs = new ServerBootstrap();
bs.channel(EpollServerSocketChannel.class);
bs.group(group).childHandler(sh);
bs.childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED);
Channel sc = bs.bind(NetUtil.LOCALHOST, 0).syncUninterruptibly().channel();
Bootstrap cb = new Bootstrap();
cb.group(group);
cb.channel(EpollSocketChannel.class);
cb.handler(new ChannelInboundHandlerAdapter());
Channel cc = cb.connect(sc.localAddress()).syncUninterruptibly().channel();
for (int i = 0; i < data.length;) {
int length = Math.min(random.nextInt(1024 * 64), data.length - i);
ByteBuf buf = Unpooled.wrappedBuffer(data, i, length);
cc.writeAndFlush(buf);
i += length;
}
while (sh.future2 == null || !sh.future2.isDone() || !sh.future.isDone()) {
if (sh.exception.get() != null) {
break;
}
Thread.sleep(50);
}
sc.close().sync();
cc.close().sync();
if (sh.exception.get() != null && !(sh.exception.get() instanceof IOException)) {
throw sh.exception.get();
}
byte[] written = new byte[data.length];
try (FileInputStream in = new FileInputStream(file)) {
assertEquals(written.length, in.read(written));
assertArrayEquals(data, written);
} finally {
group.shutdownGracefully();
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does spliceToFile() do?
spliceToFile() is a function in the netty codebase, defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSpliceTest.java.
Where is spliceToFile() defined?
spliceToFile() is defined in transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSpliceTest.java at line 188.
What does spliceToFile() call?
spliceToFile() calls 1 function(s): SpliceHandler.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free