public abstract class AbstractDataAccess extends Object implements DataAccess
| Modifier and Type | Field and Description |
|---|---|
protected BitUtil |
bitUtil |
protected ByteOrder |
byteOrder |
protected boolean |
closed |
protected static byte[] |
EMPTY |
protected int[] |
header |
protected static int |
HEADER_OFFSET |
protected int |
indexDivisor |
protected String |
name |
protected static int |
SEGMENT_SIZE_MIN |
protected int |
segmentSizeInBytes |
protected int |
segmentSizePower |
| Constructor and Description |
|---|
AbstractDataAccess(String name,
String location,
ByteOrder order) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkBeforeRename(String newName) |
void |
close()
This method makes sure that the underlying used resources are released.
|
protected void |
copyHeader(DataAccess da) |
DataAccess |
copyTo(DataAccess da)
Copies the content from this object into the specified one.
|
protected String |
getFullName() |
int |
getHeader(int bytePos)
Get 4 bytes from the header at 'index'
|
String |
getName()
The logical identification of this object.
|
int |
getSegmentSize() |
boolean |
isClosed() |
protected boolean |
isIntBased() |
boolean |
isStoring() |
protected long |
readHeader(RandomAccessFile raFile) |
void |
rename(String newName)
Renames the underlying DataAccess object.
|
void |
setHeader(int bytePos,
int value)
Set 4 bytes at the header space index to the specified value
|
DataAccess |
setSegmentSize(int bytes)
In order to increase allocated space one needs to layout the underlying storage in segments.
|
String |
toString() |
protected void |
writeHeader(RandomAccessFile file,
long length,
int segmentSize)
Writes some internal data into the beginning of the specified file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreate, ensureCapacity, getBytes, getInt, getSegments, getShort, getType, setBytes, setInt, setShort, trimToflush, getCapacity, loadExistingprotected static final int SEGMENT_SIZE_MIN
protected static final int HEADER_OFFSET
protected static final byte[] EMPTY
protected final ByteOrder byteOrder
protected final BitUtil bitUtil
protected int[] header
protected String name
protected int segmentSizeInBytes
protected int segmentSizePower
protected int indexDivisor
protected boolean closed
public String getName()
DataAccessgetName in interface DataAccessprotected String getFullName()
public void close()
Storableclose in interface Storable<DataAccess>close in interface Closeableclose in interface AutoCloseablepublic boolean isClosed()
isClosed in interface Storable<DataAccess>public void setHeader(int bytePos,
int value)
DataAccesssetHeader in interface DataAccesspublic int getHeader(int bytePos)
DataAccessgetHeader in interface DataAccessprotected void writeHeader(RandomAccessFile file, long length, int segmentSize) throws IOException
IOExceptionprotected long readHeader(RandomAccessFile raFile) throws IOException
IOExceptionprotected void copyHeader(DataAccess da)
public DataAccess copyTo(DataAccess da)
DataAccesscopyTo in interface DataAccesspublic DataAccess setSegmentSize(int bytes)
DataAccesssetSegmentSize in interface DataAccesspublic int getSegmentSize()
getSegmentSize in interface DataAccesspublic void rename(String newName)
DataAccessrename in interface DataAccessprotected boolean checkBeforeRename(String newName)
public boolean isStoring()
protected boolean isIntBased()
Copyright © 2012–2019. All rights reserved.