Class ValueGetter
- java.lang.Object
-
- io.github.sebasbaumh.postgis.binary.ValueGetter
-
public abstract class ValueGetter extends java.lang.ObjectAllows reading values.- Author:
- sbaumhekel
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteGetterdata
-
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 bytegetByte()Get a byte, should be equal for all endiansdoublegetDouble()Get a double.intgetEndian()Gets the endian encoding.intgetInt()Get an integer.protected abstract intgetInt(int index)Get a 32-Bit integerlonggetLong()Get a long.protected abstract longgetLong(int index)Get a long value.static ValueGettergetValueGetterForEndian(ByteGetter bytes)Get the appropriateValueGetterfor the given endianness.
-
-
-
Field Detail
-
data
protected final ByteGetter data
-
-
Constructor Detail
-
ValueGetter
public ValueGetter(ByteGetter data, byte endian)
Constructs an instance.- Parameters:
data-ByteGetterendian- endianess
-
-
Method Detail
-
getValueGetterForEndian
public static ValueGetter getValueGetterForEndian(ByteGetter bytes)
Get the appropriateValueGetterfor 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
-
-