Class FileDescriptor

  • Direct Known Subclasses:
    Socket

    public class FileDescriptor
    extends java.lang.Object
    Native FileDescriptor implementation which allows to wrap an int and provide a FileDescriptor for it.
    • Constructor Detail

      • FileDescriptor

        public FileDescriptor​(int fd)
    • Method Detail

      • intValue

        public final int intValue()
        Return the int value of the filedescriptor.
      • markClosed

        protected boolean markClosed()
      • close

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

        public boolean isOpen()
        Returns true if the file descriptor is open.
      • write

        public final int write​(java.nio.ByteBuffer buf,
                               int pos,
                               int limit)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeAddress

        public final int writeAddress​(long address,
                                      int pos,
                                      int limit)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writev

        public final long writev​(java.nio.ByteBuffer[] buffers,
                                 int offset,
                                 int length,
                                 long maxBytesToWrite)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writevAddresses

        public final long writevAddresses​(long memoryAddress,
                                          int length)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public final int read​(java.nio.ByteBuffer buf,
                              int pos,
                              int limit)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readAddress

        public final int readAddress​(long address,
                                     int pos,
                                     int limit)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • toString

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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

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

        public static FileDescriptor[] pipe()
                                     throws java.io.IOException
        Returns:
        [0] = read end, [1] = write end
        Throws:
        java.io.IOException