Class DataFile


  • final class DataFile
    extends java.lang.Object
    Use RandomAccessFile for concurrent access of read and write partial part's content.
    • Constructor Summary

      Constructors 
      Constructor Description
      DataFile​(java.io.File file)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void close()  
      (package private) void read​(long pointer, byte[] buf, int offset, int length)
      Read data from the given file pointer position.
      (package private) void renameTo​(java.io.File f)  
      (package private) long writeTo​(byte[] data, int offset, int length)
      Write data to the file
      • Methods inherited from class java.lang.Object

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

      • writePointer

        private long writePointer
    • Constructor Detail

      • DataFile

        DataFile​(java.io.File file)
    • Method Detail

      • close

        void close()
      • read

        void read​(long pointer,
                  byte[] buf,
                  int offset,
                  int length)
        Read data from the given file pointer position.
        Parameters:
        pointer - read position
        buf - that needs to be filled
        offset - the start offset of the data.
        length - of data that needs to be read
      • renameTo

        void renameTo​(java.io.File f)
      • writeTo

        long writeTo​(byte[] data,
                     int offset,
                     int length)
        Write data to the file
        Parameters:
        data - that needs to written to a file
        offset - start offset in the data
        length - no bytes to write
        Returns:
        file pointer before the write operation(or at which the data is written)