Class FileDescriptor

java.lang.Object
io.netty.channel.unix.FileDescriptor
Direct Known Subclasses:
Socket

public class FileDescriptor extends Object
Native FileDescriptor implementation which allows to wrap an int and provide a FileDescriptor for it.
  • Field Details

  • 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

      public void close() throws IOException
      Close the file descriptor.
      Throws:
      IOException
    • isOpen

      public boolean isOpen()
      Returns true 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • from

      public static FileDescriptor from(String path) throws IOException
      Open a new FileDescriptor for the given path.
      Throws:
      IOException
    • from

      public static FileDescriptor from(File file) throws IOException
      Open a new FileDescriptor for the given File.
      Throws:
      IOException
    • pipe

      public static FileDescriptor[] pipe() throws IOException
      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

      private static int open(String path)
    • close

      private static int close(int fd)
    • write

      private static int write(int fd, ByteBuffer buf, int pos, int limit)
    • 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

      private static int read(int fd, ByteBuffer buf, int pos, int limit)
    • readAddress

      private static int readAddress(int fd, long address, int pos, int limit)
    • newPipe

      private static long newPipe()