- java.lang.Object
-
- io.netty5.channel.unix.FileDescriptor
-
- Direct Known Subclasses:
Socket
public class FileDescriptor extends Object
NativeFileDescriptorimplementation which allows to wrap anintand provide aFileDescriptorfor it.
-
-
Constructor Summary
Constructors Constructor Description FileDescriptor(int fd)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the file descriptor.booleanequals(Object o)static FileDescriptorfrom(File file)Open a newFileDescriptorfor the givenFile.static FileDescriptorfrom(String path)Open a newFileDescriptorfor the given path.inthashCode()intintValue()Return the int value of the filedescriptor.booleanisOpen()Returnstrueif the file descriptor is open.protected booleanmarkClosed()static FileDescriptor[]pipe()intread(ByteBuffer buf, int pos, int limit)intreadAddress(long address, int pos, int limit)StringtoString()intwrite(ByteBuffer buf, int pos, int limit)intwriteAddress(long address, int pos, int limit)longwritev(ByteBuffer[] buffers, int offset, int length, long maxBytesToWrite)longwritevAddresses(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 IOExceptionClose the file descriptor.- Throws:
IOException
-
isOpen
public boolean isOpen()
Returnstrueif 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 newFileDescriptorfor the given path.- Throws:
IOException
-
from
public static FileDescriptor from(File file) throws IOException
Open a newFileDescriptorfor the givenFile.- Throws:
IOException
-
pipe
public static FileDescriptor[] pipe() throws IOException
- Returns:
- [0] = read end, [1] = write end
- Throws:
IOException
-
-