當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。