public final class IoBridge extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
JAVA_IP_MULTICAST_TTL |
static int |
JAVA_MCAST_BLOCK_SOURCE |
static int |
JAVA_MCAST_JOIN_GROUP |
static int |
JAVA_MCAST_JOIN_SOURCE_GROUP |
static int |
JAVA_MCAST_LEAVE_GROUP |
static int |
JAVA_MCAST_LEAVE_SOURCE_GROUP |
static int |
JAVA_MCAST_UNBLOCK_SOURCE |
| Modifier and Type | Method and Description |
|---|---|
static int |
available(FileDescriptor fd) |
static void |
bind(FileDescriptor fd,
InetAddress address,
int port) |
static void |
closeAndSignalBlockedThreads(FileDescriptor fd)
Closes the supplied file descriptor and sends a signal to any threads are currently blocking.
|
static void |
connect(FileDescriptor fd,
InetAddress inetAddress,
int port)
Connects socket 'fd' to 'inetAddress' on 'port', with no timeout.
|
static void |
connect(FileDescriptor fd,
InetAddress inetAddress,
int port,
int timeoutMs)
Connects socket 'fd' to 'inetAddress' on 'port', with a the given 'timeoutMs'.
|
static InetAddress |
getSocketLocalAddress(FileDescriptor fd) |
static int |
getSocketLocalPort(FileDescriptor fd) |
static Object |
getSocketOption(FileDescriptor fd,
int option)
java.net has its own socket options similar to the underlying Unix ones.
|
static boolean |
isConnected(FileDescriptor fd,
InetAddress inetAddress,
int port,
int timeoutMs,
int remainingTimeoutMs) |
static FileDescriptor |
open(String path,
int flags)
java.io only throws FileNotFoundException when opening files, regardless of what actually
went wrong.
|
static int |
read(FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount)
java.io thinks that a read at EOF is an error and should return -1, contrary to traditional
Unix practice where you'd read until you got 0 bytes (and any future read would return -1).
|
static int |
recvfrom(boolean isRead,
FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount,
int flags,
DatagramPacket packet,
boolean isConnected) |
static int |
recvfrom(boolean isRead,
FileDescriptor fd,
ByteBuffer buffer,
int flags,
DatagramPacket packet,
boolean isConnected) |
static int |
sendto(FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount,
int flags,
InetAddress inetAddress,
int port) |
static int |
sendto(FileDescriptor fd,
ByteBuffer buffer,
int flags,
InetAddress inetAddress,
int port) |
static void |
setSocketOption(FileDescriptor fd,
int option,
Object value)
java.net has its own socket options similar to the underlying Unix ones.
|
static FileDescriptor |
socket(boolean stream) |
static void |
write(FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount)
java.io always writes every byte it's asked to, or fails with an error.
|
public static final int JAVA_MCAST_JOIN_GROUP
public static final int JAVA_MCAST_LEAVE_GROUP
public static final int JAVA_MCAST_JOIN_SOURCE_GROUP
public static final int JAVA_MCAST_LEAVE_SOURCE_GROUP
public static final int JAVA_MCAST_BLOCK_SOURCE
public static final int JAVA_MCAST_UNBLOCK_SOURCE
public static final int JAVA_IP_MULTICAST_TTL
public static int available(FileDescriptor fd) throws IOException
IOExceptionpublic static void bind(FileDescriptor fd, InetAddress address, int port) throws SocketException
SocketExceptionpublic static void connect(FileDescriptor fd, InetAddress inetAddress, int port) throws SocketException
SocketExceptionpublic static void connect(FileDescriptor fd, InetAddress inetAddress, int port, int timeoutMs) throws SocketException, SocketTimeoutException
public static void closeAndSignalBlockedThreads(FileDescriptor fd) throws IOException
This method is a no-op if passed a null or already-closed file descriptor.
IOExceptionpublic static boolean isConnected(FileDescriptor fd, InetAddress inetAddress, int port, int timeoutMs, int remainingTimeoutMs) throws IOException
IOExceptionpublic static Object getSocketOption(FileDescriptor fd, int option) throws SocketException
SocketExceptionpublic static void setSocketOption(FileDescriptor fd, int option, Object value) throws SocketException
SocketExceptionpublic static FileDescriptor open(String path, int flags) throws FileNotFoundException
FileNotFoundExceptionpublic static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException
IOExceptionpublic static void write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException
IOExceptionpublic static int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port) throws IOException
IOExceptionpublic static int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws IOException
IOExceptionpublic static int recvfrom(boolean isRead,
FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount,
int flags,
DatagramPacket packet,
boolean isConnected)
throws IOException
IOExceptionpublic static int recvfrom(boolean isRead,
FileDescriptor fd,
ByteBuffer buffer,
int flags,
DatagramPacket packet,
boolean isConnected)
throws IOException
IOExceptionpublic static FileDescriptor socket(boolean stream) throws SocketException
SocketExceptionpublic static InetAddress getSocketLocalAddress(FileDescriptor fd) throws SocketException
SocketExceptionpublic static int getSocketLocalPort(FileDescriptor fd) throws SocketException
SocketException