当前位置: 首页>>代码示例>>Java>>正文


Java DataOutput.writeDouble方法代码示例

本文整理汇总了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;
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:TestDataByteBuffers.java

示例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);
    }
}
 
开发者ID:aika-algorithm,项目名称:aika,代码行数:19,代码来源:Synapse.java

示例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;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:DataSerializableJUnitTest.java

示例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]);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:GridmixSplit.java

示例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());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:DataSerializer.java

示例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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:58,代码来源:ExampleSetToStream.java

示例7: write

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput stream) throws Exception{
    stream.writeDouble(this.data);
}
 
开发者ID:RockBottomGame,项目名称:API,代码行数:5,代码来源:PartDouble.java

示例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);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:7,代码来源:Key.java

示例9: writeValueToBuffer

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void writeValueToBuffer(DataOutput buffer) throws IOException
{
	buffer.writeDouble(m_real);
	buffer.writeDouble(m_imaginary);
}
 
开发者ID:quqiangsheng,项目名称:abhot,代码行数:7,代码来源:ComplexDataPoint.java

示例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]);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:6,代码来源:ArrayPrimitiveWritable.java

示例11: write

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
protected void write(final DataOutput output) throws IOException {
  output.writeDouble(this.value);
}
 
开发者ID:KyoriPowered,项目名称:nbt,代码行数:5,代码来源:DoubleTag.java

示例12: write

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput output) throws IOException {
    output.writeDouble(value);
}
 
开发者ID:McMoonLakeDev,项目名称:MoonLakeNBT,代码行数:5,代码来源:NBTTagDouble.java

示例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());
}
 
开发者ID:quqiangsheng,项目名称:abhot,代码行数:6,代码来源:LegacyDataPointFactory.java

示例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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:NBTTagDouble.java

示例15: write

import java.io.DataOutput; //导入方法依赖的package包/类
@Override
public void write(DataOutput out) throws IOException {
    out.writeDouble(metaWeight);
    out.writeDouble(metaBias);
    out.writeBoolean(metaRelativeRid);
}
 
开发者ID:aika-algorithm,项目名称:aika,代码行数:7,代码来源:MetaSynapse.java


注:本文中的java.io.DataOutput.writeDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。