Package org.apache.jena.dboe.base.file
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 java.lang.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:
BlockAccessByteArray
-
-
Field Summary
Fields Modifier and Type Field Description static booleanSafeMode
-
Constructor Summary
Constructors Constructor Description BlockAccessMem(java.lang.String label, int blockSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Blockallocate(int blkSize)longallocBoundary()voidclose()java.lang.StringgetLabel()booleanisEmpty()voidoverwrite(Block block)Blockread(long id)voidresetAllocBoundary(long boundary)Reset the allocation space (i.e.voidsync()java.lang.StringtoString()booleanvalid(long id)voidwrite(Block block)
-
-
-
Method Detail
-
allocate
public Block allocate(int blkSize)
- Specified by:
allocatein interfaceBlockAccess
-
read
public Block read(long id)
- Specified by:
readin interfaceBlockAccess
-
write
public void write(Block block)
- Specified by:
writein interfaceBlockAccess
-
overwrite
public void overwrite(Block block)
- Specified by:
overwritein interfaceBlockAccess
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceBlockAccess
-
allocBoundary
public long allocBoundary()
- Specified by:
allocBoundaryin interfaceBlockAccess
-
resetAllocBoundary
public void resetAllocBoundary(long boundary)
Description copied from interface:BlockAccessReset 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:
resetAllocBoundaryin interfaceBlockAccess
-
valid
public boolean valid(long id)
- Specified by:
validin interfaceBlockAccess
-
close
public void close()
- Specified by:
closein interfaceorg.apache.jena.atlas.lib.Closeable
-
sync
public void sync()
- Specified by:
syncin interfaceorg.apache.jena.atlas.lib.Sync
-
getLabel
public java.lang.String getLabel()
- Specified by:
getLabelin interfaceBlockAccess
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-