S - type of buffer this layout can be applied topublic interface FloatDataLayout<S extends DataBuffer<?>> extends DataLayout<S,Float>
DataLayout that converts data stored in a buffer to floats.DataLayout| Modifier and Type | Method and Description |
|---|---|
default FloatDataBuffer |
applyTo(S buffer)
Apply this layout to the provided buffer.
|
float |
readFloat(S buffer,
long index)
Reads
n = scale() values from the buffer at the given index and return them as a float. |
default Float |
readObject(S buffer,
long index)
Reads
n = scale() values from the buffer at the given index and return them as a single
value in the user type. |
void |
writeFloat(S buffer,
float value,
long index)
Writes a float into the buffer at the given index after converting it to the buffer type.
|
default void |
writeObject(S buffer,
Float value,
long index)
Writes a user value into the buffer at the given index after converting it to the buffer type.
|
scaledefault FloatDataBuffer applyTo(S buffer)
DataLayoutThe returned DataBuffer instance is simply a wrapper to the original buffer and does
not have a backing storage of his own.
applyTo in interface DataLayout<S extends DataBuffer<?>,Float>buffer - the target buffer to apply this layout tovoid writeFloat(S buffer, float value, long index)
buffer - the buffer to write tovalue - the float to convert and writeindex - index in the buffer where the converted value should be writtenwriteObject(DataBuffer, Float, long)float readFloat(S buffer, long index)
n = scale() values from the buffer at the given index and return them as a float.buffer - the buffer to read fromindex - position of the buffer to read in the bufferreadObject(DataBuffer, long)default void writeObject(S buffer, Float value, long index)
DataLayoutIt is the responsibility of the implementors of this interface to write the converted value
to the given buffer before this call returns, using the most appropriate method. For example,
for a layout converting a BigInteger to a single long,
@Override
public void writeObject(LongDataBuffer buffer, BigInteger value, long index) {
buffer.setLong(value.longValue(), index);
}
If a single user value scales over more than one buffer values, index indicates the
starting position of the sequence to be written to the buffer.writeObject in interface DataLayout<S extends DataBuffer<?>,Float>buffer - the buffer to write tovalue - the value in the user type to convert and writeindex - index in the buffer where the converted value should be writtendefault Float readObject(S buffer, long index)
DataLayoutn = scale() values from the buffer at the given index and return them as a single
value in the user type.
It is the responsibility of the implementors of this interface to read the value to be
converted from the given buffer, using the most appropriate method. For example, for a layout
that converting a single long to a BigInteger,
@Override
public BigInteger readObject(LongDataBuffer buffer, long index) {
return BigInteger.valueOf(buffer.getLong(index));
}
If a single user value scales over more than one buffer values, index indicates the
starting position of the sequence to be read from the buffer.readObject in interface DataLayout<S extends DataBuffer<?>,Float>buffer - the buffer to read fromindex - position of the buffer to read in the bufferCopyright © 2015–2020. All rights reserved.