本文整理了Java中java.nio.ByteBuffer.putFloat()
方法的一些代码示例,展示了ByteBuffer.putFloat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuffer.putFloat()
方法的具体详情如下:
包路径:java.nio.ByteBuffer
类名称:ByteBuffer
方法名:putFloat
[英]Writes the given float to the current position and increases the position by 4.
The float is converted to bytes using the current byte order.
[中]将给定的浮点写入当前位置,并将该位置增加4。
浮点使用当前字节顺序转换为字节。
代码示例来源:origin: redisson/redisson
@Override
public void setFloat(long byteIndex, float[] source, int elemoff, int numElems) {
for ( int i=0; i <numElems; i++ ) {
buffer.putFloat((int) (byteIndex+4*i),source[i+elemoff]);
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void init(ByteBuffer buf, int position)
{
buf.putFloat(position, Float.NEGATIVE_INFINITY);
}
代码示例来源:origin: apache/incubator-druid
@Override
public void init(ByteBuffer buf, int position)
{
buf.putFloat(position, Float.POSITIVE_INFINITY);
}
代码示例来源:origin: apache/incubator-druid
@Override
public void init(ByteBuffer buf, int position)
{
buf.putFloat(position, 0.0f);
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public FloatBuffer put (int index, float c) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
byteBuffer.putFloat(index << 2, c);
return this;
}
代码示例来源:origin: libgdx/libgdx
@Override
public FloatBuffer put (int index, float c) {
if (index < 0 || index >= limit) {
throw new IndexOutOfBoundsException();
}
byteBuffer.putFloat(index << 2, c);
return this;
}
代码示例来源:origin: apache/incubator-druid
@Override
public void init(ByteBuffer buf, int position)
{
buf.putLong(position, Long.MIN_VALUE);
buf.putFloat(position + Long.BYTES, 0);
}
代码示例来源: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 init(ByteBuffer buf, int position)
{
buf.putLong(position, Long.MAX_VALUE);
buf.putFloat(position + Long.BYTES, 0);
}
代码示例来源:origin: apache/incubator-druid
@Override
public void aggregate(ByteBuffer buf, int position, float value)
{
buf.putFloat(position, Math.max(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: libgdx/libgdx
@Override
public FloatBuffer put (float c) {
if (position == limit) {
throw new BufferOverflowException();
}
byteBuffer.putFloat(position++ << 2, c);
return this;
}
代码示例来源:origin: libgdx/libgdx
@Override
public FloatBuffer put (float c) {
if (position == limit) {
throw new BufferOverflowException();
}
byteBuffer.putFloat(position++ << 2, c);
return this;
}
代码示例来源:origin: apache/incubator-druid
@Override
public byte[] getCacheKey()
{
byte[] fieldNameBytes = StringUtils.toUtf8(fieldName);
return ByteBuffer.allocate(1 + fieldNameBytes.length + Integer.BYTES * 2 + Float.BYTES * 2)
.put(AggregatorUtil.APPROX_HIST_CACHE_TYPE_ID)
.put(fieldNameBytes)
.putInt(resolution)
.putInt(numBuckets)
.putFloat(lowerLimit)
.putFloat(upperLimit).array();
}
代码示例来源:origin: apache/incubator-druid
@Override
public void writeToKeyBuffer(int keyBufferPosition, @Nullable Object obj, ByteBuffer keyBuffer)
{
keyBuffer.putFloat(keyBufferPosition, DimensionHandlerUtils.nullToZero((Float) obj));
}
代码示例来源:origin: apache/incubator-druid
public CacheKeyBuilder appendFloat(float input)
{
appendItem(FLOAT_KEY, ByteBuffer.allocate(Float.BYTES).putFloat(input).array());
return this;
}
代码示例来源:origin: apache/incubator-druid
void writeFloat(WritableByteChannel out, float floatValue) throws IOException
{
final ByteBuffer buffer = ByteBuffer.allocate(Float.BYTES);
buffer.putFloat(floatValue);
buffer.flip();
Channels.writeFully(out, buffer);
}
代码示例来源:origin: apache/incubator-druid
@Override
public void aggregate(ByteBuffer buf, int position)
{
long time = timeSelector.getLong();
long lastTime = buf.getLong(position);
if (time >= lastTime) {
buf.putLong(position, time);
buf.putFloat(position + Long.BYTES, valueSelector.getFloat());
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void aggregate(ByteBuffer buf, int position)
{
long time = timeSelector.getLong();
long firstTime = buf.getLong(position);
if (time < firstTime) {
buf.putLong(position, time);
buf.putFloat(position + Long.BYTES, valueSelector.getFloat());
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public boolean putToKeyBuffer(RowBasedKey key, int idx)
{
keyBuffer.putFloat(DimensionHandlerUtils.nullToZero((Float) key.getKey()[idx]));
return true;
}
内容来源于网络,如有侵权,请联系作者删除!