public class UnixSocketChannel extends AbstractNativeSocketChannel
Channel
implementation that uses a native unix
socketModifier 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, shutdownOutput
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, register
begin, close, end, isOpen
private 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.IOException
UnixSocketChannel(int fd)
UnixSocketChannel(int fd, UnixSocketChannel.State initialState, boolean initialBoundState)
public static final UnixSocketChannel open() throws java.io.IOException
java.io.IOException
public static final UnixSocketChannel open(UnixSocketAddress remote) throws java.io.IOException
java.io.IOException
public static final UnixSocketChannel create() throws java.io.IOException
java.io.IOException
public static final UnixSocketChannel[] pair() throws java.io.IOException
java.io.IOException
public static final UnixSocketChannel fromFD(int fd)
fd
- the file descriptor to wrapprivate boolean doConnect(SockAddrUnix remote) throws java.io.IOException
java.io.IOException
public boolean connect(UnixSocketAddress remote) throws java.io.IOException
java.io.IOException
boolean isBound()
public boolean isConnected()
isConnected
in class java.nio.channels.SocketChannel
private boolean isIdle()
public boolean isConnectionPending()
isConnectionPending
in class java.nio.channels.SocketChannel
public boolean finishConnect() throws java.io.IOException
finishConnect
in class java.nio.channels.SocketChannel
java.io.IOException
public final UnixSocketAddress getRemoteSocketAddress()
public final UnixSocketAddress getLocalSocketAddress()
public boolean connect(java.net.SocketAddress remote) throws java.io.IOException
connect
in class java.nio.channels.SocketChannel
java.io.IOException
public UnixSocket socket()
socket
in class java.nio.channels.SocketChannel
public long write(java.nio.ByteBuffer[] srcs, int offset, int length) throws java.io.IOException
write
in interface java.nio.channels.GatheringByteChannel
write
in class AbstractNativeSocketChannel
java.io.IOException
public int read(java.nio.ByteBuffer dst) throws java.io.IOException
read
in interface java.nio.channels.ReadableByteChannel
read
in class AbstractNativeSocketChannel
java.io.IOException
public int write(java.nio.ByteBuffer src) throws java.io.IOException
write
in interface java.nio.channels.WritableByteChannel
write
in class AbstractNativeSocketChannel
java.io.IOException
public java.net.SocketAddress getRemoteAddress() throws java.io.IOException
getRemoteAddress
in class java.nio.channels.SocketChannel
java.io.IOException
public java.net.SocketAddress getLocalAddress() throws java.io.IOException
getLocalAddress
in interface java.nio.channels.NetworkChannel
getLocalAddress
in class java.nio.channels.SocketChannel
java.io.IOException
public final java.util.Set<java.net.SocketOption<?>> supportedOptions()
public <T> T getOption(java.net.SocketOption<T> name) throws java.io.IOException
java.io.IOException
public <T> java.nio.channels.SocketChannel setOption(java.net.SocketOption<T> name, T value) throws java.io.IOException
setOption
in interface java.nio.channels.NetworkChannel
setOption
in class java.nio.channels.SocketChannel
java.io.IOException
public UnixSocketChannel bind(java.net.SocketAddress local) throws java.io.IOException
bind
in interface java.nio.channels.NetworkChannel
bind
in class java.nio.channels.SocketChannel
java.io.IOException