本文整理了Java中java.io.DataOutputStream.writeFloat()
方法的一些代码示例,展示了DataOutputStream.writeFloat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataOutputStream.writeFloat()
方法的具体详情如下:
包路径:java.io.DataOutputStream
类名称:DataOutputStream
方法名:writeFloat
[英]Converts the float argument to an int
using the floatToIntBits
method in class Float
, and then writes that int
value to the underlying output stream as a 4-byte quantity, high byte first. If no exception is thrown, the counter written
is incremented by 4
.
[中]使用类Float
中的floatToIntBits
方法将浮点参数转换为int
,然后将int
值作为4字节量写入基础输出流,先高字节。如果未引发异常,计数器written
将递增4
。
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeFloat(float v) throws IOException {
dos.writeFloat(v);
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public void writeFloat(float v) throws IOException {
dos.writeFloat(v);
}
代码示例来源:origin: netty/netty
@Override
public final void writeFloat(float v) throws IOException {
out.writeFloat(v);
}
代码示例来源:origin: libgdx/libgdx
public final void writeFloat (float v) throws IOException {
dos.writeFloat(v);
}
代码示例来源:origin: libgdx/libgdx
public final void writeFloat (float v) throws IOException {
dos.writeFloat(v);
}
代码示例来源:origin: redisson/redisson
@Override
public final void writeFloat(float v) throws IOException {
out.writeFloat(v);
}
代码示例来源:origin: com.h2database/h2
/**
* Write a float.
*
* @param i the value
* @return itself
*/
private Transfer writeFloat(float i) throws IOException {
out.writeFloat(i);
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
public final void writeFloat(float v) throws IOException {
out.writeFloat(v);
}
代码示例来源:origin: redisson/redisson
public void write(DataOutputStream out) throws IOException {
out.writeByte(tag);
out.writeFloat(value);
}
代码示例来源:origin: org.javassist/javassist
@Override
public void write(DataOutputStream out) throws IOException
{
out.writeByte(tag);
out.writeFloat(value);
}
代码示例来源:origin: libgdx/libgdx
/** Appends a {@code float} value to the stream. This corresponds to the {@code float32} value type in the UBJSON specification.
* @return this writer, for chaining */
public UBJsonWriter value (float value) throws IOException {
checkName();
out.writeByte('d');
out.writeFloat(value);
return this;
}
代码示例来源:origin: libgdx/libgdx
/** Appends a {@code float} value to the stream. This corresponds to the {@code float32} value type in the UBJSON specification.
* @return this writer, for chaining */
public UBJsonWriter value (float value) throws IOException {
checkName();
out.writeByte('d');
out.writeFloat(value);
return this;
}
代码示例来源:origin: voldemort/voldemort
private void writeFloat32(DataOutputStream output, Float f) throws IOException {
if(f == null)
output.writeFloat(Float.MIN_VALUE);
else if(f.floatValue() == Float.MIN_VALUE)
throw new SerializationException("Underflow: attempt to store " + Float.MIN_VALUE
+ " in float32, but that value is reserved for null.");
else
output.writeFloat(f.floatValue());
}
代码示例来源:origin: apache/incubator-pinot
public void setColumn(int colId, @Nonnull float[] values)
throws IOException {
_currentRowDataByteBuffer.position(_columnOffsets[colId]);
_currentRowDataByteBuffer.putInt(_variableSizeDataByteArrayOutputStream.size());
_currentRowDataByteBuffer.putInt(values.length);
for (float value : values) {
_variableSizeDataOutputStream.writeFloat(value);
}
}
代码示例来源:origin: libgdx/libgdx
public void sendUpdate () {
synchronized (this) {
if (!connected) return;
}
try {
out.writeInt(ACCEL);
out.writeFloat(Gdx.input.getAccelerometerX());
out.writeFloat(Gdx.input.getAccelerometerY());
out.writeFloat(Gdx.input.getAccelerometerZ());
out.writeInt(COMPASS);
out.writeFloat(Gdx.input.getAzimuth());
out.writeFloat(Gdx.input.getPitch());
out.writeFloat(Gdx.input.getRoll());
out.writeInt(SIZE);
out.writeFloat(Gdx.graphics.getWidth());
out.writeFloat(Gdx.graphics.getHeight());
out.writeInt(GYRO);
out.writeFloat(Gdx.input.getGyroscopeX());
out.writeFloat(Gdx.input.getGyroscopeY());
out.writeFloat(Gdx.input.getGyroscopeZ());
} catch (Throwable t) {
out = null;
connected = false;
}
}
代码示例来源:origin: libgdx/libgdx
public void sendUpdate () {
synchronized (this) {
if (!connected) return;
}
try {
out.writeInt(ACCEL);
out.writeFloat(Gdx.input.getAccelerometerX());
out.writeFloat(Gdx.input.getAccelerometerY());
out.writeFloat(Gdx.input.getAccelerometerZ());
out.writeInt(COMPASS);
out.writeFloat(Gdx.input.getAzimuth());
out.writeFloat(Gdx.input.getPitch());
out.writeFloat(Gdx.input.getRoll());
out.writeInt(SIZE);
out.writeFloat(Gdx.graphics.getWidth());
out.writeFloat(Gdx.graphics.getHeight());
out.writeInt(GYRO);
out.writeFloat(Gdx.input.getGyroscopeX());
out.writeFloat(Gdx.input.getGyroscopeY());
out.writeFloat(Gdx.input.getGyroscopeZ());
} catch (Throwable t) {
out = null;
connected = false;
}
}
代码示例来源:origin: libgdx/libgdx
/** Appends an optimized {@code float array} value to the stream. As an optimized array, the {@code float32} value type marker
* and element count are encoded once at the array marker instead of repeating the type marker for each element.
* @return this writer, for chaining */
public UBJsonWriter value (float[] values) throws IOException {
array();
out.writeByte('$');
out.writeByte('d');
out.writeByte('#');
value(values.length);
for (int i = 0, n = values.length; i < n; i++) {
out.writeFloat(values[i]);
}
pop(true);
return this;
}
代码示例来源:origin: libgdx/libgdx
/** Appends an optimized {@code float array} value to the stream. As an optimized array, the {@code float32} value type marker
* and element count are encoded once at the array marker instead of repeating the type marker for each element.
* @return this writer, for chaining */
public UBJsonWriter value (float[] values) throws IOException {
array();
out.writeByte('$');
out.writeByte('d');
out.writeByte('#');
value(values.length);
for (int i = 0, n = values.length; i < n; i++) {
out.writeFloat(values[i]);
}
pop(true);
return this;
}
代码示例来源:origin: google/guava
private void initializeData(DataOutputStream out) throws IOException {
/* Write out various test values NORMALLY */
out.write(new byte[] {-100, 100});
out.writeBoolean(true);
out.writeBoolean(false);
out.writeByte(100);
out.writeByte(-100);
out.writeByte((byte) 200);
out.writeChar('a');
out.writeShort((short) -30000);
out.writeShort((short) 50000);
out.writeInt(0xCAFEBABE);
out.writeLong(0xDEADBEEFCAFEBABEL);
out.writeUTF("Herby Derby");
out.writeFloat(Float.intBitsToFloat(0xCAFEBABE));
out.writeDouble(Double.longBitsToDouble(0xDEADBEEFCAFEBABEL));
}
代码示例来源:origin: hankcs/HanLP
@Override
public void save(DataOutputStream out) throws IOException
{
if (!(featureMap instanceof ImmutableFeatureMDatMap))
{
featureMap = new ImmutableFeatureMDatMap(featureMap.entrySet(), tagSet());
}
featureMap.save(out);
for (float aParameter : this.parameter)
{
out.writeFloat(aParameter);
}
}
内容来源于网络,如有侵权,请联系作者删除!