本文整理了Java中java.nio.ByteBuffer.getFloat()
方法的一些代码示例,展示了ByteBuffer.getFloat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuffer.getFloat()
方法的具体详情如下:
包路径:java.nio.ByteBuffer
类名称:ByteBuffer
方法名:getFloat
[英]Returns the float at the current position and increases the position by 4.
The 4 bytes starting at the current position are composed into a float according to the current byte order and returned.
[中]返回当前位置的浮动,并将该位置增加4。
从当前位置开始的4个字节根据当前字节顺序组成一个浮点,并返回。
代码示例来源:origin: redisson/redisson
@Override
public void getFloatArr(long byteIndex, float[] target, int elemoff, int numElems) {
for ( int i=0; i <numElems; i++ ) {
target[i+elemoff] = buffer.getFloat((int) (byteIndex+i * 4));
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public double getDouble(ByteBuffer buf, int position)
{
return (double) buf.getFloat(position + Long.BYTES);
}
代码示例来源:origin: apache/incubator-druid
@Override
public void getFromByteBuffer(ByteBuffer buffer, int initialOffset, int dimValIdx, Comparable[] dimValues)
{
dimValues[dimValIdx] = buffer.getFloat(initialOffset + keyBufferPosition);
}
代码示例来源:origin: apache/incubator-druid
@Override
public float getFloat(ByteBuffer buf, int position)
{
return buf.getFloat(position + Long.BYTES);
}
代码示例来源:origin: apache/incubator-druid
@Override
public long getLong(ByteBuffer buf, int position)
{
return (long) buf.getFloat(position + Long.BYTES);
}
代码示例来源:origin: apache/incubator-druid
@Override
public final long getLong(ByteBuffer buf, int position)
{
return (long) buf.getFloat(position);
}
代码示例来源:origin: apache/incubator-druid
@Override
public double getDouble(ByteBuffer buffer, int position)
{
return (double) buffer.getFloat(position);
}
代码示例来源:origin: apache/incubator-druid
@Override
public long getLong(ByteBuffer buf, int position)
{
return (long) buf.getFloat(position + Long.BYTES);
}
代码示例来源:origin: apache/incubator-druid
@Override
public float getFloat(ByteBuffer buf, int position)
{
return buf.getFloat(position + Long.BYTES);
}
代码示例来源:origin: libgdx/libgdx
@Override
public float get (int index) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
return byteBuffer.getFloat(index << 2);
}
代码示例来源:origin: libgdx/libgdx
@Override
public float get (int index) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
return byteBuffer.getFloat(index << 2);
}
代码示例来源:origin: apache/incubator-druid
@Override
public void aggregate(ByteBuffer buf, int position, float value)
{
buf.putFloat(position, buf.getFloat(position) + value);
}
代码示例来源:origin: apache/incubator-druid
@Override
public void aggregate(ByteBuffer buf, int position, float value)
{
buf.putFloat(position, Math.min(buf.getFloat(position), value));
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void aggregate(ByteBuffer buf, int position, float value)
{
buf.putFloat(position, Math.max(buf.getFloat(position), value));
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public float get () {
if (position == limit) {
throw new BufferUnderflowException();
}
return byteBuffer.getFloat(position++ << 2);
}
代码示例来源:origin: libgdx/libgdx
@Override
public float get () {
if (position == limit) {
throw new BufferUnderflowException();
}
return byteBuffer.getFloat(position++ << 2);
}
代码示例来源:origin: apache/incubator-druid
@Override
public Object get(ByteBuffer buf, int position)
{
long[] bins = new long[breaks.length + 1];
ByteBuffer mutationBuffer = buf.duplicate();
mutationBuffer.position(position);
mutationBuffer.asLongBuffer().get(bins);
float min = mutationBuffer.getFloat(position + minOffset);
float max = mutationBuffer.getFloat(position + maxOffset);
return new Histogram(breaks, bins, min, max);
}
代码示例来源:origin: redisson/redisson
/**
* Read the next {@code float} from the underlying {@link ByteBuffer}.
*
* @return The next {@code float}.
*/
public float readFloat() {
if (null != buffer) {
return buffer.getFloat();
}
throw new BufferUnderflowException();
}
代码示例来源:origin: apache/incubator-druid
@Override
public void processValueFromGroupingKey(
GroupByColumnSelectorPlus selectorPlus,
ByteBuffer key,
Map<String, Object> resultMap,
int keyBufferPosition
)
{
final float val = key.getFloat(keyBufferPosition);
resultMap.put(selectorPlus.getOutputName(), val);
}
代码示例来源:origin: apache/incubator-druid
@Override
public Object get(ByteBuffer buf, int position)
{
return new SerializablePair<>(buf.getLong(position), buf.getFloat(position + Long.BYTES));
}
内容来源于网络,如有侵权,请联系作者删除!