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, wait
create, ensureCapacity, getByte, getBytes, getInt, getSegments, getShort, getType, setByte, setBytes, setInt, setShort, trimTo
flush, getCapacity, loadExisting
protected 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()
DataAccess
getName
in interface DataAccess
protected String getFullName()
public void close()
Storable
close
in interface Storable<DataAccess>
close
in interface Closeable
close
in interface AutoCloseable
public boolean isClosed()
isClosed
in interface Storable<DataAccess>
public void setHeader(int bytePos, int value)
DataAccess
setHeader
in interface DataAccess
public int getHeader(int bytePos)
DataAccess
getHeader
in interface DataAccess
protected void writeHeader(RandomAccessFile file, long length, int segmentSize) throws IOException
IOException
protected long readHeader(RandomAccessFile raFile) throws IOException
IOException
protected void copyHeader(DataAccess da)
public DataAccess copyTo(DataAccess da)
DataAccess
copyTo
in interface DataAccess
public DataAccess setSegmentSize(int bytes)
DataAccess
setSegmentSize
in interface DataAccess
public int getSegmentSize()
getSegmentSize
in interface DataAccess
public void rename(String newName)
DataAccess
rename
in interface DataAccess
protected boolean checkBeforeRename(String newName)
public boolean isStoring()
protected boolean isIntBased()
Copyright © 2012–2020. All rights reserved.