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) boolean
connect
(SocketAddress remote) boolean
connect
(UnixSocketAddress remote) static final UnixSocketChannel
create()
boolean
static final UnixSocketChannel
fromFD
(int fd) Create a UnixSocketChannel to wrap an existing file descriptor (presumably itself a UNIX socket).final UnixSocketAddress
<T> T
getOption
(SocketOption<T> name) final UnixSocketAddress
boolean
boolean
static final UnixSocketChannel
open()
static final UnixSocketChannel
open
(UnixSocketAddress remote) static final UnixSocketChannel[]
pair()
int
read
(ByteBuffer dst) <T> SocketChannel
setOption
(SocketOption<T> name, T value) socket()
final Set<SocketOption<?>>
int
write
(ByteBuffer src) long
write
(ByteBuffer[] srcs, int offset, int length) Methods inherited from class jnr.enxio.channels.AbstractNativeSocketChannel
getFD, implCloseSelectableChannel, implConfigureBlocking, read, setFD, shutdownInput, shutdownOutput
Methods inherited from class java.nio.channels.spi.AbstractSelectableChannel
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register
Methods inherited from class java.nio.channels.SelectableChannel
register
Methods 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:
isConnected
in classSocketChannel
-
isConnectionPending
public boolean isConnectionPending()- Specified by:
isConnectionPending
in classSocketChannel
-
finishConnect
- Specified by:
finishConnect
in classSocketChannel
- Throws:
IOException
-
getRemoteSocketAddress
-
getLocalSocketAddress
-
connect
- Specified by:
connect
in classSocketChannel
- Throws:
IOException
-
socket
- Specified by:
socket
in classSocketChannel
-
write
- Specified by:
write
in interfaceGatheringByteChannel
- Overrides:
write
in classAbstractNativeSocketChannel
- Throws:
IOException
-
read
- Specified by:
read
in interfaceReadableByteChannel
- Overrides:
read
in classAbstractNativeSocketChannel
- Throws:
IOException
-
write
- Specified by:
write
in interfaceWritableByteChannel
- Overrides:
write
in classAbstractNativeSocketChannel
- Throws:
IOException
-
getRemoteAddress
- Specified by:
getRemoteAddress
in classSocketChannel
- Throws:
IOException
-
getLocalAddress
- Specified by:
getLocalAddress
in interfaceNetworkChannel
- Specified by:
getLocalAddress
in classSocketChannel
- Throws:
IOException
-
supportedOptions
-
getOption
- Throws:
IOException
-
setOption
- Specified by:
setOption
in interfaceNetworkChannel
- Specified by:
setOption
in classSocketChannel
- Throws:
IOException
-
bind
- Specified by:
bind
in interfaceNetworkChannel
- Specified by:
bind
in classSocketChannel
- Throws:
IOException
-