public class UnixSocketChannel
extends jnr.enxio.channels.AbstractNativeSocketChannel
Channel implementation that uses a native unix
socket| Modifier and Type | Class and Description |
|---|---|
private static class |
UnixSocketChannel.DefaultOptionsHolder |
(package private) static class |
UnixSocketChannel.State |
| Modifier and Type | Field and Description |
|---|---|
private BindHandler |
bindHandler |
private UnixSocketAddress |
localAddress |
private UnixSocketAddress |
remoteAddress |
private UnixSocketChannel.State |
state |
private java.util.concurrent.locks.ReadWriteLock |
stateLock |
| Constructor and Description |
|---|
UnixSocketChannel() |
UnixSocketChannel(int fd) |
UnixSocketChannel(int fd,
UnixSocketChannel.State initialState,
boolean initialBoundState) |
| Modifier and Type | Method and Description |
|---|---|
UnixSocketChannel |
bind(java.net.SocketAddress local) |
boolean |
connect(java.net.SocketAddress remote) |
boolean |
connect(UnixSocketAddress remote) |
static UnixSocketChannel |
create() |
private boolean |
doConnect(SockAddrUnix remote) |
boolean |
finishConnect() |
static UnixSocketChannel |
fromFD(int fd)
Create a UnixSocketChannel to wrap an existing file descriptor
(presumably itself a UNIX socket).
|
java.net.SocketAddress |
getLocalAddress() |
UnixSocketAddress |
getLocalSocketAddress() |
<T> T |
getOption(java.net.SocketOption<T> name) |
java.net.SocketAddress |
getRemoteAddress() |
UnixSocketAddress |
getRemoteSocketAddress() |
(package private) boolean |
isBound() |
boolean |
isConnected() |
boolean |
isConnectionPending() |
private boolean |
isIdle() |
static UnixSocketChannel |
open() |
static UnixSocketChannel |
open(UnixSocketAddress remote) |
static UnixSocketChannel[] |
pair() |
int |
read(java.nio.ByteBuffer dst) |
<T> java.nio.channels.SocketChannel |
setOption(java.net.SocketOption<T> name,
T value) |
UnixSocket |
socket() |
java.util.Set<java.net.SocketOption<?>> |
supportedOptions() |
int |
write(java.nio.ByteBuffer src) |
long |
write(java.nio.ByteBuffer[] srcs,
int offset,
int length) |
getFD, implCloseSelectableChannel, implConfigureBlocking, read, setFD, shutdownInput, shutdownOutputblockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, registerbegin, close, end, isOpenprivate UnixSocketChannel.State state
private UnixSocketAddress remoteAddress
private UnixSocketAddress localAddress
private final java.util.concurrent.locks.ReadWriteLock stateLock
private final BindHandler bindHandler
UnixSocketChannel()
throws java.io.IOException
java.io.IOExceptionUnixSocketChannel(int fd)
UnixSocketChannel(int fd,
UnixSocketChannel.State initialState,
boolean initialBoundState)
public static final UnixSocketChannel open() throws java.io.IOException
java.io.IOExceptionpublic static final UnixSocketChannel open(UnixSocketAddress remote) throws java.io.IOException
java.io.IOExceptionpublic static final UnixSocketChannel create() throws java.io.IOException
java.io.IOExceptionpublic static final UnixSocketChannel[] pair() throws java.io.IOException
java.io.IOExceptionpublic static final UnixSocketChannel fromFD(int fd)
fd - the file descriptor to wrapprivate boolean doConnect(SockAddrUnix remote) throws java.io.IOException
java.io.IOExceptionpublic boolean connect(UnixSocketAddress remote) throws java.io.IOException
java.io.IOExceptionboolean isBound()
public boolean isConnected()
isConnected in class java.nio.channels.SocketChannelprivate boolean isIdle()
public boolean isConnectionPending()
isConnectionPending in class java.nio.channels.SocketChannelpublic boolean finishConnect()
throws java.io.IOException
finishConnect in class java.nio.channels.SocketChanneljava.io.IOExceptionpublic final UnixSocketAddress getRemoteSocketAddress()
public final UnixSocketAddress getLocalSocketAddress()
public boolean connect(java.net.SocketAddress remote)
throws java.io.IOException
connect in class java.nio.channels.SocketChanneljava.io.IOExceptionpublic UnixSocket socket()
socket in class java.nio.channels.SocketChannelpublic long write(java.nio.ByteBuffer[] srcs,
int offset,
int length)
throws java.io.IOException
write in interface java.nio.channels.GatheringByteChannelwrite in class jnr.enxio.channels.AbstractNativeSocketChanneljava.io.IOExceptionpublic int read(java.nio.ByteBuffer dst)
throws java.io.IOException
read in interface java.nio.channels.ReadableByteChannelread in class jnr.enxio.channels.AbstractNativeSocketChanneljava.io.IOExceptionpublic int write(java.nio.ByteBuffer src)
throws java.io.IOException
write in interface java.nio.channels.WritableByteChannelwrite in class jnr.enxio.channels.AbstractNativeSocketChanneljava.io.IOExceptionpublic java.net.SocketAddress getRemoteAddress()
throws java.io.IOException
getRemoteAddress in class java.nio.channels.SocketChanneljava.io.IOExceptionpublic java.net.SocketAddress getLocalAddress()
throws java.io.IOException
getLocalAddress in interface java.nio.channels.NetworkChannelgetLocalAddress in class java.nio.channels.SocketChanneljava.io.IOExceptionpublic final java.util.Set<java.net.SocketOption<?>> supportedOptions()
public <T> T getOption(java.net.SocketOption<T> name)
throws java.io.IOException
java.io.IOExceptionpublic <T> java.nio.channels.SocketChannel setOption(java.net.SocketOption<T> name,
T value)
throws java.io.IOException
setOption in interface java.nio.channels.NetworkChannelsetOption in class java.nio.channels.SocketChanneljava.io.IOExceptionpublic UnixSocketChannel bind(java.net.SocketAddress local) throws java.io.IOException
bind in interface java.nio.channels.NetworkChannelbind in class java.nio.channels.SocketChanneljava.io.IOException