Class AbstractDataAccess

java.lang.Object
com.graphhopper.storage.AbstractDataAccess
All Implemented Interfaces:
DataAccess, Closeable, AutoCloseable
Direct Known Subclasses:
MMapDataAccess, RAMDataAccess

public abstract class AbstractDataAccess extends Object implements DataAccess
Author:
Peter Karich
  • 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

      protected final ByteOrder byteOrder
    • bitUtil

      protected final BitUtil bitUtil
    • name

      protected String name
    • segmentSizeInBytes

      protected int segmentSizeInBytes
    • segmentSizePower

      protected int segmentSizePower
    • indexDivisor

      protected int indexDivisor
    • closed

      protected boolean closed
  • Constructor Details

    • AbstractDataAccess

      public AbstractDataAccess(String name, String location, int segmentSize)
  • Method Details

    • getName

      public String getName()
      Description copied from interface: DataAccess
      The logical identification of this object.
      Specified by:
      getName in interface DataAccess
    • getFullName

      protected String 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 interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface DataAccess
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface DataAccess
    • 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 interface DataAccess
    • getHeader

      public int getHeader(int bytePos)
      Description copied from interface: DataAccess
      Get 4 bytes from the header at 'index'
      Specified by:
      getHeader in interface DataAccess
    • writeHeader

      protected void writeHeader(RandomAccessFile file, long length, int segmentSize) throws IOException
      Writes some internal data into the beginning of the specified file.
      Throws:
      IOException
    • readHeader

      protected long readHeader(RandomAccessFile raFile) throws IOException
      Throws:
      IOException
    • copyHeader

      protected void copyHeader(DataAccess da)
    • getSegmentSize

      public int getSegmentSize()
      Specified by:
      getSegmentSize in interface DataAccess
      Returns:
      the size of one segment in bytes
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isStoring

      public boolean isStoring()
    • isIntBased

      protected boolean isIntBased()