Package io.netty.channel.unix
Class FileDescriptor
java.lang.Object
io.netty.channel.unix.FileDescriptor
- Direct Known Subclasses:
Socket
Native
FileDescriptor
implementation which allows to wrap an int
and provide a
FileDescriptor
for it.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int
(package private) int
Bit map = [Output Shutdown | Input Shutdown | Closed]private static final int
private static final int
private static final int
private static final int
private static final AtomicIntegerFieldUpdater
<FileDescriptor> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final boolean
casState
(int expected, int update) void
close()
Close the file descriptor.private static int
close
(int fd) boolean
static FileDescriptor
Open a newFileDescriptor
for the givenFile
.static FileDescriptor
Open a newFileDescriptor
for the given path.int
hashCode()
(package private) static int
inputShutdown
(int state) final 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()
Returnstrue
if the file descriptor is open.(package private) static boolean
isOutputShutdown
(int state) protected boolean
private static long
newPipe()
private static int
(package private) static int
outputShutdown
(int state) static FileDescriptor[]
pipe()
private static int
read
(int fd, ByteBuffer buf, int pos, int limit) final int
read
(ByteBuffer buf, int pos, int limit) private static int
readAddress
(int fd, long address, int pos, int limit) final int
readAddress
(long address, int pos, int limit) toString()
private static int
write
(int fd, ByteBuffer buf, int pos, int limit) final int
write
(ByteBuffer buf, int pos, int limit) private static int
writeAddress
(int fd, long address, int pos, int limit) final int
writeAddress
(long address, int pos, int limit) private static long
writev
(int fd, ByteBuffer[] buffers, int offset, int length, long maxBytesToWrite) final long
writev
(ByteBuffer[] buffers, int offset, int length, long maxBytesToWrite) private static long
writevAddresses
(int fd, long memoryAddress, int length) final long
writevAddresses
(long memoryAddress, int length)
-
Field Details
-
stateUpdater
-
STATE_CLOSED_MASK
private static final int STATE_CLOSED_MASK- See Also:
-
STATE_INPUT_SHUTDOWN_MASK
private static final int STATE_INPUT_SHUTDOWN_MASK- See Also:
-
STATE_OUTPUT_SHUTDOWN_MASK
private static final int STATE_OUTPUT_SHUTDOWN_MASK- See Also:
-
STATE_ALL_MASK
private static final int STATE_ALL_MASK- See Also:
-
state
volatile int stateBit map = [Output Shutdown | Input Shutdown | Closed] -
fd
final int fd
-
-
Constructor Details
-
FileDescriptor
public FileDescriptor(int fd)
-
-
Method Details
-
intValue
public final int intValue()Return the int value of the filedescriptor. -
markClosed
protected boolean markClosed() -
close
Close the file descriptor.- Throws:
IOException
-
isOpen
public boolean isOpen()Returnstrue
if the file descriptor is open. -
write
- Throws:
IOException
-
writeAddress
- Throws:
IOException
-
writev
public final long writev(ByteBuffer[] buffers, int offset, int length, long maxBytesToWrite) throws IOException - Throws:
IOException
-
writevAddresses
- Throws:
IOException
-
read
- Throws:
IOException
-
readAddress
- Throws:
IOException
-
toString
-
equals
-
hashCode
public int hashCode() -
from
Open a newFileDescriptor
for the given path.- Throws:
IOException
-
from
Open a newFileDescriptor
for the givenFile
.- Throws:
IOException
-
pipe
- Returns:
- [0] = read end, [1] = write end
- Throws:
IOException
-
casState
final boolean casState(int expected, int update) -
isClosed
static boolean isClosed(int state) -
isInputShutdown
static boolean isInputShutdown(int state) -
isOutputShutdown
static boolean isOutputShutdown(int state) -
inputShutdown
static int inputShutdown(int state) -
outputShutdown
static int outputShutdown(int state) -
open
-
close
private static int close(int fd) -
write
-
writeAddress
private static int writeAddress(int fd, long address, int pos, int limit) -
writev
private static long writev(int fd, ByteBuffer[] buffers, int offset, int length, long maxBytesToWrite) -
writevAddresses
private static long writevAddresses(int fd, long memoryAddress, int length) -
read
-
readAddress
private static int readAddress(int fd, long address, int pos, int limit) -
newPipe
private static long newPipe()
-