Class BlockAccessMem

java.lang.Object
org.apache.jena.dboe.base.file.BlockAccessMem
All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable, org.apache.jena.atlas.lib.Sync, BlockAccess

public class BlockAccessMem extends Object implements BlockAccess
File access layer that simulates a disk in-memory - for testing, not written for efficiency. There is a safe mode, whereby blocks are copied in and out to guarantee no writing to an unallocated block. This is very inefficient but a better simulation of a disk.
See Also:
  • Field Details

    • SafeMode

      public static boolean SafeMode
  • Constructor Details

    • BlockAccessMem

      public BlockAccessMem(String label, int blockSize)
  • Method Details

    • allocate

      public Block allocate(int blkSize)
      Specified by:
      allocate in interface BlockAccess
    • read

      public Block read(long id)
      Specified by:
      read in interface BlockAccess
    • write

      public void write(Block block)
      Specified by:
      write in interface BlockAccess
    • overwrite

      public void overwrite(Block block)
      Specified by:
      overwrite in interface BlockAccess
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface BlockAccess
    • allocBoundary

      public long allocBoundary()
      Specified by:
      allocBoundary in interface BlockAccess
    • resetAllocBoundary

      public void resetAllocBoundary(long boundary)
      Description copied from interface: BlockAccess
      Reset the allocation space (i.e. truncate). The boundary should be a number obtained from a previous call of allocLimit. It can not be greater than the current allocation boundary.
      Specified by:
      resetAllocBoundary in interface BlockAccess
    • valid

      public boolean valid(long id)
      Specified by:
      valid in interface BlockAccess
    • close

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

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

      public String getLabel()
      Specified by:
      getLabel in interface BlockAccess
    • toString

      public String toString()
      Overrides:
      toString in class Object