Class File


  • public class File
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int SEEK_CUR  
      static int SEEK_END  
      static int SEEK_SET  
    • Constructor Summary

      Constructors 
      Constructor Description
      File​(java.lang.String path)
      Constructor, opens the file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the file.
      static void nativeInit()
      Class initializer, to initialize various JNI stuff
      protected void open​(java.lang.String path)
      Opens the file whose name is the string pointed to by path.
      long read​(long size, long nMemb)
      Read elements of a file.
      void seek​(long offset, long origin)
      Write elements into a file.
      long write​(long size, long nMemb)
      Write elements into a file.
      • Methods inherited from class java.lang.Object

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

      • File

        public File​(java.lang.String path)
        Constructor, opens the file.
        Parameters:
        path - is the file location on the storage
    • Method Detail

      • open

        protected void open​(java.lang.String path)
        Opens the file whose name is the string pointed to by path.
        Parameters:
        path - is the file location on the storage
      • read

        public long read​(long size,
                         long nMemb)
        Read elements of a file.
        Parameters:
        size - of each element
        nMemb - is the number of elements of data to write
        Returns:
        the actually read size
      • write

        public long write​(long size,
                          long nMemb)
        Write elements into a file.
        Parameters:
        size - of each element
        nMemb - is the number of elements of data to write
        Returns:
        the actually written size
      • seek

        public void seek​(long offset,
                         long origin)
        Write elements into a file.
        Parameters:
        offset - : number of bytes to offset from origin
        origin - : Position used as reference for the offset. It is specified by one of the following constants defined in <stdio.h> exclusively to be used as arguments for this function (SEEK_SET = beginning of file, SEEK_CUR = current position of the file pointer, SEEK_END = end of file)
      • close

        public void close()
        Close the file.
      • nativeInit

        public static void nativeInit()
        Class initializer, to initialize various JNI stuff