Class TFileInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class TFileInputStream
    extends java.io.InputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean closed  
      private java.io.FileDescriptor fd  
      private java.lang.String path
      The path of the referenced file (null if the stream is created with a file descriptor)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      private int available0​(java.io.FileDescriptor fd)  
      void close()  
      java.io.FileDescriptor getFD()  
      private void open​(java.lang.String name)
      Opens the specified file for reading.
      private int open0​(java.io.FileDescriptor fd, java.lang.String name)
      Opens the specified file for reading.
      int read()  
      int read​(byte[] b)  
      int read​(byte[] b, int off, int len)  
      private int read0​(java.io.FileDescriptor fd)  
      private int readBytes​(java.io.FileDescriptor df, byte[] b, int off, int len)  
      long skip​(long n)  
      private long skip0​(java.io.FileDescriptor fd, int n)  
      • Methods inherited from class java.io.InputStream

        mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fd

        private final java.io.FileDescriptor fd
      • path

        private final java.lang.String path
        The path of the referenced file (null if the stream is created with a file descriptor)
      • closed

        private volatile boolean closed
    • Constructor Detail

      • TFileInputStream

        public TFileInputStream​(java.lang.String name)
                         throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • TFileInputStream

        public TFileInputStream​(java.io.File file)
                         throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • TFileInputStream

        public TFileInputStream​(java.io.FileDescriptor fdObj)
    • Method Detail

      • open0

        private int open0​(java.io.FileDescriptor fd,
                          java.lang.String name)
                   throws java.io.FileNotFoundException
        Opens the specified file for reading.
        Parameters:
        name - the name of the file
        Throws:
        java.io.FileNotFoundException
      • open

        private void open​(java.lang.String name)
                   throws java.io.FileNotFoundException
        Opens the specified file for reading.
        Parameters:
        name - the name of the file
        Throws:
        java.io.FileNotFoundException
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read0

        private int read0​(java.io.FileDescriptor fd)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • readBytes

        private int readBytes​(java.io.FileDescriptor df,
                              byte[] b,
                              int off,
                              int len)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip0

        private long skip0​(java.io.FileDescriptor fd,
                           int n)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • available0

        private int available0​(java.io.FileDescriptor fd)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
      • getFD

        public final java.io.FileDescriptor getFD()
                                           throws java.io.IOException
        Throws:
        java.io.IOException