Class ValueGetter
- java.lang.Object
-
- io.github.sebasbaumh.postgis.binary.ValueGetter
-
public abstract class ValueGetter extends java.lang.Object
Allows reading values.- Author:
- sbaumhekel
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteGetter
data
-
Constructor Summary
Constructors Constructor Description ValueGetter(ByteGetter data, byte endian)
Constructs an instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description byte
getByte()
Get a byte, should be equal for all endiansdouble
getDouble()
Get a double.int
getEndian()
Gets the endian encoding.int
getInt()
Get an integer.protected abstract int
getInt(int index)
Get a 32-Bit integerlong
getLong()
Get a long.protected abstract long
getLong(int index)
Get a long value.static ValueGetter
getValueGetterForEndian(ByteGetter bytes)
Get the appropriateValueGetter
for the given endianness.
-
-
-
Field Detail
-
data
protected final ByteGetter data
-
-
Constructor Detail
-
ValueGetter
public ValueGetter(ByteGetter data, byte endian)
Constructs an instance.- Parameters:
data
-ByteGetter
endian
- endianess
-
-
Method Detail
-
getValueGetterForEndian
public static ValueGetter getValueGetterForEndian(ByteGetter bytes)
Get the appropriateValueGetter
for the given endianness.- Parameters:
bytes
-ByteGetter
- Returns:
ValueGetter
- Throws:
java.lang.IllegalArgumentException
- if the endian type is unknown
-
getByte
public byte getByte()
Get a byte, should be equal for all endians- Returns:
- the byte value
-
getDouble
public double getDouble()
Get a double.- Returns:
- the double value
-
getEndian
public int getEndian()
Gets the endian encoding.- Returns:
- endian encoding
-
getInt
public int getInt()
Get an integer.- Returns:
- interger
-
getInt
protected abstract int getInt(int index)
Get a 32-Bit integer- Parameters:
index
- the index to get the value from- Returns:
- the int value
-
getLong
public long getLong()
Get a long.- Returns:
- long
-
getLong
protected abstract long getLong(int index)
Get a long value. This is not needed directly, but as a nice side-effect from GetDouble.- Parameters:
index
- the index to get the value from- Returns:
- the long value
-
-