Package com.graphhopper.storage
Class AbstractDataAccess
java.lang.Object
com.graphhopper.storage.AbstractDataAccess
- All Implemented Interfaces:
DataAccess,Closeable,AutoCloseable
- Direct Known Subclasses:
MMapDataAccess,RAMDataAccess
- Author:
- Peter Karich
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method makes sure that the underlying used resources are released.protected voidcopyHeader(DataAccess da) protected StringintgetHeader(int bytePos) Get 4 bytes from the header at 'index'getName()The logical identification of this object.intbooleanisClosed()protected booleanbooleanprotected longreadHeader(RandomAccessFile raFile) voidsetHeader(int bytePos, int value) Set 4 bytes at the header space index to the specified valuetoString()protected voidwriteHeader(RandomAccessFile file, long length, int segmentSize) Writes some internal data into the beginning of the specified file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.graphhopper.storage.DataAccess
create, ensureCapacity, flush, getByte, getBytes, getCapacity, getInt, getSegments, getShort, getType, loadExisting, setByte, setBytes, setInt, setShort
-
Field Details
-
SEGMENT_SIZE_MIN
protected static final int SEGMENT_SIZE_MIN- See Also:
-
HEADER_OFFSET
protected static final int HEADER_OFFSET- See Also:
-
EMPTY
protected static final byte[] EMPTY -
byteOrder
-
bitUtil
-
header
protected int[] header -
name
-
segmentSizeInBytes
protected int segmentSizeInBytes -
segmentSizePower
protected int segmentSizePower -
indexDivisor
protected int indexDivisor -
closed
protected boolean closed
-
-
Constructor Details
-
AbstractDataAccess
-
-
Method Details
-
getName
Description copied from interface:DataAccessThe logical identification of this object.- Specified by:
getNamein interfaceDataAccess
-
getFullName
-
close
public void close()Description copied from interface:DataAccessThis method makes sure that the underlying used resources are released. WARNING: it does NOT flush on close!- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDataAccess
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceDataAccess
-
setHeader
public void setHeader(int bytePos, int value) Description copied from interface:DataAccessSet 4 bytes at the header space index to the specified value- Specified by:
setHeaderin interfaceDataAccess
-
getHeader
public int getHeader(int bytePos) Description copied from interface:DataAccessGet 4 bytes from the header at 'index'- Specified by:
getHeaderin interfaceDataAccess
-
writeHeader
Writes some internal data into the beginning of the specified file.- Throws:
IOException
-
readHeader
- Throws:
IOException
-
copyHeader
-
getSegmentSize
public int getSegmentSize()- Specified by:
getSegmentSizein interfaceDataAccess- Returns:
- the size of one segment in bytes
-
toString
-
isStoring
public boolean isStoring() -
isIntBased
protected boolean isIntBased()
-