public class FileDescriptor
extends java.lang.Object
FileDescriptor
implementation which allows to wrap an int
and provide a
FileDescriptor
for it.Modifier and Type | Field and Description |
---|---|
(package private) int |
fd |
private static java.nio.channels.ClosedChannelException |
READ_ADDRESS_CLOSED_CHANNEL_EXCEPTION |
private static Errors.NativeIoException |
READ_ADDRESS_CONNECTION_RESET_EXCEPTION |
private static java.nio.channels.ClosedChannelException |
READ_CLOSED_CHANNEL_EXCEPTION |
private static Errors.NativeIoException |
READ_CONNECTION_RESET_EXCEPTION |
(package private) int |
state
Bit map = [Output Shutdown | Input Shutdown | Closed]
|
private static int |
STATE_ALL_MASK |
private static int |
STATE_CLOSED_MASK |
private static int |
STATE_INPUT_SHUTDOWN_MASK |
private static int |
STATE_OUTPUT_SHUTDOWN_MASK |
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<FileDescriptor> |
stateUpdater |
private static java.nio.channels.ClosedChannelException |
WRITE_ADDRESS_CLOSED_CHANNEL_EXCEPTION |
private static Errors.NativeIoException |
WRITE_ADDRESS_CONNECTION_RESET_EXCEPTION |
private static java.nio.channels.ClosedChannelException |
WRITE_CLOSED_CHANNEL_EXCEPTION |
private static Errors.NativeIoException |
WRITE_CONNECTION_RESET_EXCEPTION |
private static java.nio.channels.ClosedChannelException |
WRITEV_ADDRESSES_CLOSED_CHANNEL_EXCEPTION |
private static Errors.NativeIoException |
WRITEV_ADDRESSES_CONNECTION_RESET_EXCEPTION |
private static java.nio.channels.ClosedChannelException |
WRITEV_CLOSED_CHANNEL_EXCEPTION |
private static Errors.NativeIoException |
WRITEV_CONNECTION_RESET_EXCEPTION |
Constructor and Description |
---|
FileDescriptor(int fd) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
casState(int expected,
int update) |
void |
close()
Close the file descriptor.
|
private static int |
close(int fd) |
boolean |
equals(java.lang.Object o) |
static FileDescriptor |
from(java.io.File file)
Open a new
FileDescriptor for the given File . |
static FileDescriptor |
from(java.lang.String path)
Open a new
FileDescriptor for the given path. |
int |
hashCode() |
(package private) static int |
inputShutdown(int state) |
int |
intValue()
Return the int value of the filedescriptor.
|
(package private) static boolean |
isClosed(int state) |
(package private) static boolean |
isInputShutdown(int state) |
boolean |
isOpen()
Returns
true if the file descriptor is open. |
(package private) static boolean |
isOutputShutdown(int state) |
private static long |
newPipe() |
private static int |
open(java.lang.String path) |
(package private) static int |
outputShutdown(int state) |
static FileDescriptor[] |
pipe() |
int |
read(java.nio.ByteBuffer buf,
int pos,
int limit) |
private static int |
read(int fd,
java.nio.ByteBuffer buf,
int pos,
int limit) |
private static int |
readAddress(int fd,
long address,
int pos,
int limit) |
int |
readAddress(long address,
int pos,
int limit) |
java.lang.String |
toString() |
int |
write(java.nio.ByteBuffer buf,
int pos,
int limit) |
private static int |
write(int fd,
java.nio.ByteBuffer buf,
int pos,
int limit) |
private static int |
writeAddress(int fd,
long address,
int pos,
int limit) |
int |
writeAddress(long address,
int pos,
int limit) |
long |
writev(java.nio.ByteBuffer[] buffers,
int offset,
int length) |
private static long |
writev(int fd,
java.nio.ByteBuffer[] buffers,
int offset,
int length) |
private static long |
writevAddresses(int fd,
long memoryAddress,
int length) |
long |
writevAddresses(long memoryAddress,
int length) |
private static final java.nio.channels.ClosedChannelException WRITE_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException WRITE_ADDRESS_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException WRITEV_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException WRITEV_ADDRESSES_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException READ_CLOSED_CHANNEL_EXCEPTION
private static final java.nio.channels.ClosedChannelException READ_ADDRESS_CLOSED_CHANNEL_EXCEPTION
private static final Errors.NativeIoException WRITE_CONNECTION_RESET_EXCEPTION
private static final Errors.NativeIoException WRITE_ADDRESS_CONNECTION_RESET_EXCEPTION
private static final Errors.NativeIoException WRITEV_CONNECTION_RESET_EXCEPTION
private static final Errors.NativeIoException WRITEV_ADDRESSES_CONNECTION_RESET_EXCEPTION
private static final Errors.NativeIoException READ_CONNECTION_RESET_EXCEPTION
private static final Errors.NativeIoException READ_ADDRESS_CONNECTION_RESET_EXCEPTION
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<FileDescriptor> stateUpdater
private static final int STATE_CLOSED_MASK
private static final int STATE_INPUT_SHUTDOWN_MASK
private static final int STATE_OUTPUT_SHUTDOWN_MASK
private static final int STATE_ALL_MASK
volatile int state
final int fd
public int intValue()
public void close() throws java.io.IOException
java.io.IOException
public boolean isOpen()
true
if the file descriptor is open.public final int write(java.nio.ByteBuffer buf, int pos, int limit) throws java.io.IOException
java.io.IOException
public final int writeAddress(long address, int pos, int limit) throws java.io.IOException
java.io.IOException
public final long writev(java.nio.ByteBuffer[] buffers, int offset, int length) throws java.io.IOException
java.io.IOException
public final long writevAddresses(long memoryAddress, int length) throws java.io.IOException
java.io.IOException
public final int read(java.nio.ByteBuffer buf, int pos, int limit) throws java.io.IOException
java.io.IOException
public final int readAddress(long address, int pos, int limit) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static FileDescriptor from(java.lang.String path) throws java.io.IOException
FileDescriptor
for the given path.java.io.IOException
public static FileDescriptor from(java.io.File file) throws java.io.IOException
FileDescriptor
for the given File
.java.io.IOException
public static FileDescriptor[] pipe() throws java.io.IOException
java.io.IOException
final boolean casState(int expected, int update)
static boolean isClosed(int state)
static boolean isInputShutdown(int state)
static boolean isOutputShutdown(int state)
static int inputShutdown(int state)
static int outputShutdown(int state)
private static int open(java.lang.String path)
private static int close(int fd)
private static int write(int fd, java.nio.ByteBuffer buf, int pos, int limit)
private static int writeAddress(int fd, long address, int pos, int limit)
private static long writev(int fd, java.nio.ByteBuffer[] buffers, int offset, int length)
private static long writevAddresses(int fd, long memoryAddress, int length)
private static int read(int fd, java.nio.ByteBuffer buf, int pos, int limit)
private static int readAddress(int fd, long address, int pos, int limit)
private static long newPipe()