Package jnr.unixsocket
Class UnixSocketChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,GatheringByteChannel,InterruptibleChannel,NetworkChannel,ReadableByteChannel,ScatteringByteChannel,WritableByteChannel,jnr.enxio.channels.NativeSelectableChannel
A
Channel implementation that uses a native unix
socket-
Method Summary
Modifier and TypeMethodDescriptionbind(SocketAddress local) booleanconnect(SocketAddress remote) booleanconnect(UnixSocketAddress remote) static final UnixSocketChannelcreate()booleanstatic final UnixSocketChannelfromFD(int fd) Create a UnixSocketChannel to wrap an existing file descriptor (presumably itself a UNIX socket).final UnixSocketAddress<T> TgetOption(SocketOption<T> name) final UnixSocketAddressbooleanbooleanstatic final UnixSocketChannelopen()static final UnixSocketChannelopen(UnixSocketAddress remote) static final UnixSocketChannel[]pair()intread(ByteBuffer dst) <T> SocketChannelsetOption(SocketOption<T> name, T value) socket()final Set<SocketOption<?>>intwrite(ByteBuffer src) longwrite(ByteBuffer[] srcs, int offset, int length) Methods inherited from class jnr.unixsocket.impl.AbstractNativeSocketChannel
getFD, implCloseSelectableChannel, implConfigureBlocking, read, setFD, shutdownInput, shutdownOutputMethods inherited from class java.nio.channels.SocketChannel
open, read, validOps, writeMethods inherited from class java.nio.channels.spi.AbstractSelectableChannel
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, registerMethods inherited from class java.nio.channels.SelectableChannel
registerMethods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
Method Details
-
open
- Throws:
IOException
-
open
- Throws:
IOException
-
create
- Throws:
IOException
-
pair
- Throws:
IOException
-
fromFD
Create a UnixSocketChannel to wrap an existing file descriptor (presumably itself a UNIX socket).- Parameters:
fd- the file descriptor to wrap- Returns:
- the new UnixSocketChannel instance
-
connect
- Throws:
IOException
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin classSocketChannel
-
isConnectionPending
public boolean isConnectionPending()- Specified by:
isConnectionPendingin classSocketChannel
-
finishConnect
- Specified by:
finishConnectin classSocketChannel- Throws:
IOException
-
getRemoteSocketAddress
-
getLocalSocketAddress
-
connect
- Specified by:
connectin classSocketChannel- Throws:
IOException
-
socket
- Specified by:
socketin classSocketChannel
-
write
- Specified by:
writein interfaceGatheringByteChannel- Overrides:
writein classAbstractNativeSocketChannel- Throws:
IOException
-
read
- Specified by:
readin interfaceReadableByteChannel- Overrides:
readin classAbstractNativeSocketChannel- Throws:
IOException
-
write
- Specified by:
writein interfaceWritableByteChannel- Overrides:
writein classAbstractNativeSocketChannel- Throws:
IOException
-
getRemoteAddress
- Specified by:
getRemoteAddressin classSocketChannel- Throws:
IOException
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceNetworkChannel- Specified by:
getLocalAddressin classSocketChannel- Throws:
IOException
-
supportedOptions
-
getOption
- Throws:
IOException
-
setOption
- Specified by:
setOptionin interfaceNetworkChannel- Specified by:
setOptionin classSocketChannel- Throws:
IOException
-
bind
- Specified by:
bindin interfaceNetworkChannel- Specified by:
bindin classSocketChannel- Throws:
IOException
-