javaclient-servernettyzero-copy

Netty Zero-copy in windows


1)Is Netty's zero-copy work on windows 7?

2)Does anyone have examples of Netty's zero-copy usage for client-server?

3) I have also found an example of zero-copy using FileChannel, what's the defference between netty realization and java.nio.channels.FileChannel realization?


Solution

  • Just use DefaultFileRegion and it should work on Linux/MacOS/Windows. This makes internally use of FileChannel..

    Something like:

    FileRegion region = new DefaultFileRegion(...);
    channel.writeAndFlush(region);