Interface StoreDataAccessor

  • All Known Implementing Classes:
    IOStoreDataAccessor, ScatteringStoreDataAccessor

    interface StoreDataAccessor
    An interface for low level store data access methods. This is used to implement a variety of ways of accessing data from some resource, such as a file in a filesystem. For example, we might use this to access a file using the NIO API, or through the IO API. Alternatively we may use it to implement a scattering store that includes data across multiple files in the filesystem.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Closes the underlying data area representation.
      boolean delete()
      Deletes the data area resource.
      boolean exists()
      Returns true if the resource exists.
      long getSize()
      Returns the current size of the underlying data area.
      void open​(boolean read_only)
      Opens the underlying data area representation.
      void read​(long position, byte[] buf, int off, int len)
      Reads a block of data from the underlying data area at the given position into the byte array at the given offset.
      void setSize​(long new_size)
      Sets the size of the underlying data area to the given size.
      void synch()
      Synchronizes the data area by forcing any data out of the OS buffers onto the disk.
      void write​(long position, byte[] buf, int off, int len)
      Writes a block of data to the underlying data area from the byte array at the given offset.
    • Method Detail

      • exists

        boolean exists()
        Returns true if the resource exists.
      • delete

        boolean delete()
        Deletes the data area resource. Returns true if the delete was successful.
      • open

        void open​(boolean read_only)
           throws java.io.IOException
        Opens the underlying data area representation. If the resource doesn't exist then it is created and the size is set to 0.
        Throws:
        java.io.IOException
      • close

        void close()
            throws java.io.IOException
        Closes the underlying data area representation.
        Throws:
        java.io.IOException
      • read

        void read​(long position,
                  byte[] buf,
                  int off,
                  int len)
           throws java.io.IOException
        Reads a block of data from the underlying data area at the given position into the byte array at the given offset.
        Throws:
        java.io.IOException
      • write

        void write​(long position,
                   byte[] buf,
                   int off,
                   int len)
            throws java.io.IOException
        Writes a block of data to the underlying data area from the byte array at the given offset.
        Throws:
        java.io.IOException
      • setSize

        void setSize​(long new_size)
              throws java.io.IOException
        Sets the size of the underlying data area to the given size. If the size of the data area is increased, the content between the old size and the new size is implementation defined.
        Throws:
        java.io.IOException
      • getSize

        long getSize()
              throws java.io.IOException
        Returns the current size of the underlying data area.
        Throws:
        java.io.IOException
      • synch

        void synch()
            throws java.io.IOException
        Synchronizes the data area by forcing any data out of the OS buffers onto the disk.
        Throws:
        java.io.IOException