- java.lang.Object
-
- io.netty5.channel.unix.FileDescriptor
-
- Direct Known Subclasses:
Socket
public class FileDescriptor extends Object
NativeFileDescriptor
implementation which allows to wrap anint
and provide aFileDescriptor
for it.
-
-
Constructor Summary
Constructors Constructor Description FileDescriptor(int fd)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the file descriptor.boolean
equals(Object o)
static FileDescriptor
from(File file)
Open a newFileDescriptor
for the givenFile
.static FileDescriptor
from(String path)
Open a newFileDescriptor
for the given path.int
hashCode()
int
intValue()
Return the int value of the filedescriptor.boolean
isOpen()
Returnstrue
if the file descriptor is open.protected boolean
markClosed()
static FileDescriptor[]
pipe()
int
read(ByteBuffer buf, int pos, int limit)
int
readAddress(long address, int pos, int limit)
String
toString()
int
write(ByteBuffer buf, int pos, int limit)
int
writeAddress(long address, int pos, int limit)
long
writev(ByteBuffer[] buffers, int offset, int length, long maxBytesToWrite)
long
writevAddresses(long memoryAddress, int length)
-
-
-
Method Detail
-
intValue
public final int intValue()
Return the int value of the filedescriptor.
-
markClosed
protected boolean markClosed()
-
close
public void close() throws IOException
Close the file descriptor.- Throws:
IOException
-
isOpen
public boolean isOpen()
Returnstrue
if the file descriptor is open.
-
write
public final int write(ByteBuffer buf, int pos, int limit) throws IOException
- Throws:
IOException
-
writeAddress
public final int writeAddress(long address, int pos, int limit) throws IOException
- Throws:
IOException
-
writev
public final long writev(ByteBuffer[] buffers, int offset, int length, long maxBytesToWrite) throws IOException
- Throws:
IOException
-
writevAddresses
public final long writevAddresses(long memoryAddress, int length) throws IOException
- Throws:
IOException
-
read
public final int read(ByteBuffer buf, int pos, int limit) throws IOException
- Throws:
IOException
-
readAddress
public final int readAddress(long address, int pos, int limit) throws IOException
- Throws:
IOException
-
from
public static FileDescriptor from(String path) throws IOException
Open a newFileDescriptor
for the given path.- Throws:
IOException
-
from
public static FileDescriptor from(File file) throws IOException
Open a newFileDescriptor
for the givenFile
.- Throws:
IOException
-
pipe
public static FileDescriptor[] pipe() throws IOException
- Returns:
- [0] = read end, [1] = write end
- Throws:
IOException
-
-