Class BinaryDataFileWrapper

  • All Implemented Interfaces:
    org.apache.jena.atlas.lib.Closeable, org.apache.jena.atlas.lib.Sync, BinaryDataFile

    public class BinaryDataFileWrapper
    extends java.lang.Object
    implements BinaryDataFile
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean isOpen()
      Is it open?
      long length()
      Return the length of the file (including any buffered writes)
      void open()
      Open the file
      int read​(long posn, byte[] b)
      Read into a byte array, returning the number of bytes read.
      int read​(long posn, byte[] b, int start, int length)
      Read into a byte array, returning the number of bytes read.
      void sync()  
      void truncate​(long length)
      Truncate the file
      long write​(byte[] b)
      Write bytes - bytes are always written to the end of the file.
      long write​(byte[] b, int start, int length)
      Write bytes - bytes are always written to the end of the file.
      • Methods inherited from class java.lang.Object

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

      • BinaryDataFileWrapper

        public BinaryDataFileWrapper​(BinaryDataFile other)
    • Method Detail

      • read

        public int read​(long posn,
                        byte[] b)
        Description copied from interface: BinaryDataFile
        Read into a byte array, returning the number of bytes read. Reads are at an absolute position and a read is atomic/thread-safe.
        Specified by:
        read in interface BinaryDataFile
        Parameters:
        posn - Location of the read operation.
        b - byte array
        Returns:
        The number of bytes read
      • read

        public int read​(long posn,
                        byte[] b,
                        int start,
                        int length)
        Description copied from interface: BinaryDataFile
        Read into a byte array, returning the number of bytes read. Reads are at an absolute position and a read is atomic/thread-safe.
        Specified by:
        read in interface BinaryDataFile
        Parameters:
        posn - Location of the read operation.
        start - of bytesarray to read into
        length - Maximum number of bytes to read.
        Returns:
        The number of bytes read
      • write

        public long write​(byte[] b)
        Description copied from interface: BinaryDataFile
        Write bytes - bytes are always written to the end of the file. Return the location where the write started.
        Specified by:
        write in interface BinaryDataFile
      • write

        public long write​(byte[] b,
                          int start,
                          int length)
        Description copied from interface: BinaryDataFile
        Write bytes - bytes are always written to the end of the file. Return the location where the write started.
        Specified by:
        write in interface BinaryDataFile
      • length

        public long length()
        Description copied from interface: BinaryDataFile
        Return the length of the file (including any buffered writes)
        Specified by:
        length in interface BinaryDataFile
      • sync

        public void sync()
        Specified by:
        sync in interface BinaryDataFile
        Specified by:
        sync in interface org.apache.jena.atlas.lib.Sync
      • close

        public void close()
        Specified by:
        close in interface BinaryDataFile
        Specified by:
        close in interface org.apache.jena.atlas.lib.Closeable