Package io.netty.channel.unix
Class UnixChannelUtil
- java.lang.Object
-
- io.netty.channel.unix.UnixChannelUtil
-
public final class UnixChannelUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Class<?>FILE_CHANNEL_IMPL_CLASSprivate static intS_IFMTprivate static intS_IFSOCK
-
Constructor Summary
Constructors Modifier Constructor Description privateUnixChannelUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.InetSocketAddresscomputeRemoteAddr(java.net.InetSocketAddress remoteAddr, java.net.InetSocketAddress osRemoteAddr)static booleandeleteDomainSocketFile(java.lang.String path)Delete the file atpathbut only if it is a socket inode (as left behind by a bound domain socket).static booleanisBufferCopyNeededForWrite(ByteBuf byteBuf)Checks if the specified buffer has memory address or is composed of n(n <= IOV_MAX) NIO direct buffers.(package private) static booleanisBufferCopyNeededForWrite(ByteBuf byteBuf, int iovMax)static booleanisFileChannelImpl(java.nio.channels.FileChannel channel)Returns whether the given channel is an instance ofsun.nio.ch.FileChannelImpl.private static booleanisSocket(java.nio.file.Path file)
-
-
-
Field Detail
-
S_IFMT
private static final int S_IFMT
- See Also:
- Constant Field Values
-
S_IFSOCK
private static final int S_IFSOCK
- See Also:
- Constant Field Values
-
FILE_CHANNEL_IMPL_CLASS
private static final java.lang.Class<?> FILE_CHANNEL_IMPL_CLASS
-
-
Method Detail
-
isFileChannelImpl
public static boolean isFileChannelImpl(java.nio.channels.FileChannel channel)
Returns whether the given channel is an instance ofsun.nio.ch.FileChannelImpl.
-
isBufferCopyNeededForWrite
public static boolean isBufferCopyNeededForWrite(ByteBuf byteBuf)
Checks if the specified buffer has memory address or is composed of n(n <= IOV_MAX) NIO direct buffers. (We check this because otherwise we need to make it a new direct buffer.)
-
isBufferCopyNeededForWrite
static boolean isBufferCopyNeededForWrite(ByteBuf byteBuf, int iovMax)
-
deleteDomainSocketFile
public static boolean deleteDomainSocketFile(java.lang.String path)
Delete the file atpathbut only if it is a socket inode (as left behind by a bound domain socket). Any other kind of file (regular file, directory, symbolic link, FIFO, device, ...) is left alone. Symbolic links are never followed. This requires Java 7 or later, on older versions nothing is deleted.- Returns:
trueif the file was deleted.
-
isSocket
private static boolean isSocket(java.nio.file.Path file) throws java.io.IOException- Throws:
java.io.IOException
-
computeRemoteAddr
public static java.net.InetSocketAddress computeRemoteAddr(java.net.InetSocketAddress remoteAddr, java.net.InetSocketAddress osRemoteAddr)
-
-