Class ValueGetter
- java.lang.Object
-
- io.github.sebasbaumh.postgis.binary.ValueGetter
-
- Direct Known Subclasses:
BinaryValueGetter,StringValueGetter
public abstract class ValueGetter extends Object
A base class for value readers.- Author:
- Sebastian Baumhekel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceValueGetter.IntBuilderBuilder for an int from a byte sequence.protected static interfaceValueGetter.LongBuilderBuilder for a long from a byte sequence.
-
Field Summary
Fields Modifier and Type Field Description protected intendianCurrent encoding (default is little endian encoding).protected ValueGetter.IntBuilderfuncIntBuilder for integer values respecting the current encoding (default is little endian encoding).protected ValueGetter.LongBuilderfuncLongBuilder for long values respecting the current encoding (default is little endian encoding).
-
Constructor Summary
Constructors Constructor Description ValueGetter()Constructs an instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description doublegetDouble()Get a double value.intgetInt()Get an integer value.longgetLong()Get a long value.protected abstract intgetNextByte()Gets a byte at the current index.voidreadEncoding()Reads the encoding and adjusts the internal decoder if necessary.
-
-
-
Field Detail
-
endian
protected int endian
Current encoding (default is little endian encoding).
-
funcInt
protected ValueGetter.IntBuilder funcInt
Builder for integer values respecting the current encoding (default is little endian encoding).
-
funcLong
protected ValueGetter.LongBuilder funcLong
Builder for long values respecting the current encoding (default is little endian encoding).
-
-
Method Detail
-
getDouble
public double getDouble()
Get a double value.- Returns:
- double value
-
getInt
public int getInt()
Get an integer value.- Returns:
- integer value
-
getLong
public long getLong()
Get a long value.- Returns:
- long value
-
getNextByte
protected abstract int getNextByte()
Gets a byte at the current index.- Returns:
- byte
- Throws:
IndexOutOfBoundsException- if the current index is out of the range
-
readEncoding
public void readEncoding()
Reads the encoding and adjusts the internal decoder if necessary.- Throws:
IllegalArgumentException- if the endian type is unknown
-
-