本文整理汇总了Java中java.io.DataOutput.writeDouble方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutput.writeDouble方法的具体用法?Java DataOutput.writeDouble怎么用?Java DataOutput.writeDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataOutput
的用法示例。
在下文中一共展示了DataOutput.writeDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeJunk
import java.io.DataOutput; //导入方法依赖的package包/类
private static void writeJunk(DataOutput out, Random r, long seed, int iter)
throws IOException {
r.setSeed(seed);
for (int i = 0; i < iter; ++i) {
switch (r.nextInt(7)) {
case 0: out.writeByte(r.nextInt()); break;
case 1: out.writeShort((short)(r.nextInt() & 0xFFFF)); break;
case 2: out.writeInt(r.nextInt()); break;
case 3: out.writeLong(r.nextLong()); break;
case 4: out.writeDouble(r.nextDouble()); break;
case 5: out.writeFloat(r.nextFloat()); break;
case 6:
byte[] b = new byte[r.nextInt(1024)];
r.nextBytes(b);
out.write(b);
break;
}
}
}
示例2: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
out.writeInt(input.id);
out.writeInt(output.id);
out.writeInt(inputNode.id);
key.write(out);
out.writeDouble(weight);
out.writeDouble(bias);
out.writeBoolean(isConjunction);
out.writeBoolean(meta != null);
if(meta != null) {
meta.write(out);
}
}
示例3: toData
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public boolean toData(Object o, DataOutput out) throws IOException {
if (o instanceof NonDataSerializable) {
NonDataSerializable nds = (NonDataSerializable) o;
out.writeByte(CLASS_ID);
out.writeInt(nds.intValue);
out.writeDouble(nds.doubleValue);
out.writeUTF(nds.stringValue);
writeObject(nds.dsValue, out);
writeObject(nds.serValue, out);
writeObject(nds.objectValue, out);
return true;
} else {
return false;
}
}
示例4: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
super.write(out);
WritableUtils.writeVInt(out, id);
WritableUtils.writeVInt(out, maps);
WritableUtils.writeVLong(out, inputRecords);
WritableUtils.writeVLong(out, outputBytes);
WritableUtils.writeVLong(out, outputRecords);
WritableUtils.writeVLong(out, maxMemory);
WritableUtils.writeVInt(out, reduces);
for (int i = 0; i < reduces; ++i) {
out.writeDouble(reduceBytes[i]);
out.writeDouble(reduceRecords[i]);
}
WritableUtils.writeVInt(out, nSpec);
for (int i = 0; i < nSpec; ++i) {
WritableUtils.writeVLong(out, reduceOutputBytes[i]);
WritableUtils.writeVLong(out, reduceOutputRecords[i]);
}
}
示例5: writeDouble
import java.io.DataOutput; //导入方法依赖的package包/类
/**
* Writes an instance of <code>Double</code> to a <code>DataOutput</code>.
*
* @throws IOException A problem occurs while writing to <code>out</code>
* @throws NullPointerException if value is null.
*
* @see #readDouble
*/
public static void writeDouble(Double value, DataOutput out) throws IOException {
InternalDataSerializer.checkOut(out);
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER, "Writing Double {}", value);
}
out.writeDouble(value.doubleValue());
}
示例6: writeDatum
import java.io.DataOutput; //导入方法依赖的package包/类
/**
* Writes a single datum with the given index. The data type is specified by the parameter
* columnType. If sparse is true, the value is prefixed by the given attributeIndex.
*/
public final void writeDatum(final double value, final int attributeIndex, final Attribute attribute,
final ColumnType columnType, final DataOutput out, final boolean sparse) throws IOException {
if (sparse) {
if (Tools.isDefault(attribute.getDefault(), value)) {
return;
} else {
out.writeInt(attributeIndex);
}
}
switch (columnType) {
case DOUBLE:
out.writeDouble(value);
break;
case INTEGER:
if (Double.isNaN(value)) {
out.writeInt(Integer.MIN_VALUE + 1);
out.writeBoolean(true);
} else {
out.writeInt((int) value);
if ((int) value == Integer.MIN_VALUE + 1) {
out.writeBoolean(false);
}
}
break;
// For the nominal values, we *can* use -1 to encode missings since all values are
// guaranteed to be non-negative
case NOMINAL_BYTE:
if (Double.isNaN(value)) {
out.writeByte(-1);
} else {
out.writeByte((byte) value);
}
break;
case NOMINAL_INTEGER:
if (Double.isNaN(value)) {
out.writeInt(-1);
} else {
out.writeInt((int) value);
}
break;
case NOMINAL_SHORT:
if (Double.isNaN(value)) {
out.writeShort(-1);
} else {
out.writeShort((short) value);
}
break;
default:
// cannot happen
throw new RuntimeException("Illegal type: " + columnType);
}
}
示例7: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput stream) throws Exception{
stream.writeDouble(this.data);
}
示例8: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
out.writeInt(bytes.length);
out.write(bytes);
out.writeDouble(weight);
}
示例9: writeValueToBuffer
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void writeValueToBuffer(DataOutput buffer) throws IOException
{
buffer.writeDouble(m_real);
buffer.writeDouble(m_imaginary);
}
示例10: writeDoubleArray
import java.io.DataOutput; //导入方法依赖的package包/类
private void writeDoubleArray(DataOutput out) throws IOException {
double[] v = (double[]) value;
for (int i = 0; i < length; i++)
out.writeDouble(v[i]);
}
示例11: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
protected void write(final DataOutput output) throws IOException {
output.writeDouble(this.value);
}
示例12: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput output) throws IOException {
output.writeDouble(value);
}
示例13: writeToByteBuffer
import java.io.DataOutput; //导入方法依赖的package包/类
public static void writeToByteBuffer(DataOutput buffer, LegacyDoubleDataPoint dataPoint) throws IOException
{
buffer.writeByte(DOUBLE_VALUE);
buffer.writeDouble(dataPoint.getDoubleValue());
}
示例14: write
import java.io.DataOutput; //导入方法依赖的package包/类
/**
* Write the actual data contents of the tag, implemented in NBT extension classes
*/
void write(DataOutput output) throws IOException
{
output.writeDouble(this.data);
}
示例15: write
import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
out.writeDouble(metaWeight);
out.writeDouble(metaBias);
out.writeBoolean(metaRelativeRid);
}