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 TypeMethodDescriptionvoid
close()
This method makes sure that the underlying used resources are released.protected void
copyHeader
(DataAccess da) protected String
int
getHeader
(int bytePos) Get 4 bytes from the header at 'index'getName()
The logical identification of this object.int
boolean
isClosed()
protected boolean
boolean
protected long
readHeader
(RandomAccessFile raFile) void
setHeader
(int bytePos, int value) Set 4 bytes at the header space index to the specified valuetoString()
protected void
writeHeader
(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, wait
Methods 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:DataAccess
The logical identification of this object.- Specified by:
getName
in interfaceDataAccess
-
getFullName
-
close
public void close()Description copied from interface:DataAccess
This method makes sure that the underlying used resources are released. WARNING: it does NOT flush on close!- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceDataAccess
-
isClosed
public boolean isClosed()- Specified by:
isClosed
in interfaceDataAccess
-
setHeader
public void setHeader(int bytePos, int value) Description copied from interface:DataAccess
Set 4 bytes at the header space index to the specified value- Specified by:
setHeader
in interfaceDataAccess
-
getHeader
public int getHeader(int bytePos) Description copied from interface:DataAccess
Get 4 bytes from the header at 'index'- Specified by:
getHeader
in 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:
getSegmentSize
in interfaceDataAccess
- Returns:
- the size of one segment in bytes
-
toString
-
isStoring
public boolean isStoring() -
isIntBased
protected boolean isIntBased()
-