java.io.DataOutputStream.writeDouble()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中java.io.DataOutputStream.writeDouble()方法的一些代码示例,展示了DataOutputStream.writeDouble()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataOutputStream.writeDouble()方法的具体详情如下:
包路径:java.io.DataOutputStream
类名称:DataOutputStream
方法名:writeDouble

DataOutputStream.writeDouble介绍

[英]Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the underlying output stream as an 8-byte quantity, high byte first. If no exception is thrown, the counter written is incremented by 8.
[中]使用类Double中的doubleToLongBits方法将双参数转换为long,然后将long值作为8字节量写入基础输出流,先高字节。如果未引发异常,计数器written将递增8

代码示例

代码示例来源:origin: hankcs/HanLP

public void save(DataOutputStream out) throws Exception
{
  out.writeInt(m);
  out.writeInt(n);
  for (int i = 0; i < m; i++)
  {
    for (int j = 0; j < n; j++)
    {
      out.writeDouble(A[i][j]);
    }
  }
}

代码示例来源:origin: hankcs/HanLP

@Override
public void save(DataOutputStream out) throws IOException
{
  out.writeInt(size);
  for (int i = 0; i < size; i++)
  {
    out.writeInt(data[i]);
  }
  out.writeInt(linearExpandFactor);
  out.writeBoolean(exponentialExpanding);
  out.writeDouble(exponentialExpandFactor);
}

代码示例来源:origin: hankcs/HanLP

@Override
public void save(DataOutputStream out) throws Exception
{
  out.writeInt(o.length);
  for (char c : o)
  {
    out.writeChar(c);
  }
  out.writeInt(w.length);
  for (double v : w)
  {
    out.writeDouble(v);
  }
}

代码示例来源:origin: wildfly/wildfly

public static byte[] createAuthenticationDigest(String passcode,long t1,double q1) throws IOException,
                                             NoSuchAlgorithmException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream(512);
  DataOutputStream out=new DataOutputStream(baos);
  byte[] digest=createDigest(passcode,t1,q1);
  out.writeLong(t1);
  out.writeDouble(q1);
  out.writeInt(digest.length);
  out.write(digest);
  out.flush();
  return baos.toByteArray();
}

代码示例来源:origin: marytts/marytts

public void write(DataOutputStream dos) throws IOException {
  dos.writeFloat(mvfAnalysisWindowSizeInSeconds);
  dos.writeFloat(mvfAnalysisSkipSizeInSeconds);
  dos.writeFloat(f0AnalysisWindowSizeInSeconds);
  dos.writeFloat(f0AnalysisSkipSizeInSeconds);
  dos.writeInt(fftSize);
  dos.writeInt(numFilteringStages);
  dos.writeInt(medianFilterLength);
  dos.writeInt(movingAverageFilterLength);
  dos.writeFloat(numPeriodsInitialPitchEstimation);
  dos.writeDouble(cumulativeAmpThreshold);
  dos.writeDouble(maximumAmpThresholdInDB);
  dos.writeDouble(harmonicDeviationPercent);
  dos.writeDouble(sharpPeakAmpDiffInDB);
  dos.writeInt(minimumTotalHarmonics);
  dos.writeInt(maximumTotalHarmonics);
  dos.writeFloat(minimumVoicedFrequencyOfVoicing);
  dos.writeFloat(maximumVoicedFrequencyOfVoicing);
  dos.writeFloat(maximumFrequencyOfVoicingFinalShift);
  dos.writeFloat(runningMeanVoicingThreshold);
  dos.writeInt(lastCorrelatedHarmonicNeighbour);
  dos.writeDouble(vuvSearchMinHarmonicMultiplier);
  dos.writeDouble(vuvSearchMaxHarmonicMultiplier);
  dos.writeDouble(neighsPercent);
}

代码示例来源:origin: marytts/marytts

public void write(DataOutputStream dos) throws IOException {
  dos.writeFloat(mvfAnalysisWindowSizeInSeconds);
  dos.writeFloat(mvfAnalysisSkipSizeInSeconds);
  dos.writeFloat(f0AnalysisWindowSizeInSeconds);
  dos.writeFloat(f0AnalysisSkipSizeInSeconds);
  dos.writeInt(fftSize);
  dos.writeInt(numFilteringStages);
  dos.writeInt(medianFilterLength);
  dos.writeInt(movingAverageFilterLength);
  dos.writeFloat(numPeriodsInitialPitchEstimation);
  dos.writeDouble(cumulativeAmpThreshold);
  dos.writeDouble(maximumAmpThresholdInDB);
  dos.writeDouble(harmonicDeviationPercent);
  dos.writeDouble(sharpPeakAmpDiffInDB);
  dos.writeInt(minimumTotalHarmonics);
  dos.writeInt(maximumTotalHarmonics);
  dos.writeFloat(minimumVoicedFrequencyOfVoicing);
  dos.writeFloat(maximumVoicedFrequencyOfVoicing);
  dos.writeFloat(maximumFrequencyOfVoicingFinalShift);
  dos.writeFloat(runningMeanVoicingThreshold);
  dos.writeInt(lastCorrelatedHarmonicNeighbour);
  dos.writeDouble(vuvSearchMinHarmonicMultiplier);
  dos.writeDouble(vuvSearchMaxHarmonicMultiplier);
  dos.writeDouble(neighsPercent);
}

代码示例来源:origin: HotswapProjects/HotswapAgent

public void write(DataOutputStream out) throws IOException {
    if (value instanceof String) {
      out.writeByte(CONSTANT_UTF8);
      out.writeUTF((String) value);
    } else if (value instanceof Integer) {
      out.writeByte(CONSTANT_INTEGER);
      out.writeInt(((Integer) value).intValue());
    } else if (value instanceof Float) {
      out.writeByte(CONSTANT_FLOAT);
      out.writeFloat(((Float) value).floatValue());
    } else if (value instanceof Long) {
      out.writeByte(CONSTANT_LONG);
      out.writeLong(((Long) value).longValue());
    } else if (value instanceof Double) {
      out.writeDouble(CONSTANT_DOUBLE);
      out.writeDouble(((Double) value).doubleValue());
    } else {
      throw new InternalError("bogus value entry: " + value);
    }
  }
}

代码示例来源:origin: HotswapProjects/HotswapAgent

public void write(DataOutputStream out) throws IOException {
    if (value instanceof String) {
      out.writeByte(CONSTANT_UTF8);
      out.writeUTF((String) value);
    } else if (value instanceof Integer) {
      out.writeByte(CONSTANT_INTEGER);
      out.writeInt(((Integer) value).intValue());
    } else if (value instanceof Float) {
      out.writeByte(CONSTANT_FLOAT);
      out.writeFloat(((Float) value).floatValue());
    } else if (value instanceof Long) {
      out.writeByte(CONSTANT_LONG);
      out.writeLong(((Long) value).longValue());
    } else if (value instanceof Double) {
      out.writeDouble(CONSTANT_DOUBLE);
      out.writeDouble(((Double) value).doubleValue());
    } else {
      throw new InternalError("bogus value entry: " + value);
    }
  }
}

代码示例来源:origin: deeplearning4j/nd4j

private static void writeMinMaxStrategy(MinMaxStrategy strategy, DataOutputStream dos) throws IOException {
  dos.writeInt(Strategy.MIN_MAX.ordinal());
  dos.writeDouble(strategy.getMinRange());
  dos.writeDouble(strategy.getMaxRange());
}

代码示例来源:origin: btraceio/btrace

private static void writeLdc(LdcInsnNode lin, DataOutputStream dos) throws IOException {
  Object o = lin.cst;
  if (o instanceof Integer) {
    dos.writeShort(1);
    dos.writeInt((Integer)o);
  } else if (o instanceof Float) {
    dos.writeShort(2);
    dos.writeFloat((Float)o);
  } else if (o instanceof Long) {
    dos.writeShort(3);
    dos.writeLong((Long)o);
  } else if (o instanceof Double) {
    dos.writeShort(4);
    dos.writeDouble((Double)o);
  } else if (o instanceof String) {
    dos.writeShort(5);
    dos.writeUTF((String)o);
  } else if (o instanceof Type) {
    dos.writeShort(6);
    dos.writeUTF(((Type)o).getDescriptor());
  } else {
    dos.writeShort(0);
  }
}

代码示例来源: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: addthis/stream-lib

public static byte[] serialize(QDigest d) {
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  DataOutputStream s = new DataOutputStream(bos);
  try {
    s.writeLong(d.size);
    s.writeDouble(d.compressionFactor);
    s.writeLong(d.capacity);
    s.writeInt(d.node2count.size());
    for (long k : d.node2count.keySet()) {
      s.writeLong(k);
      s.writeLong(d.node2count.get(k));
    }
    return bos.toByteArray();
  } catch (IOException e) {
    // Should never happen
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: hankcs/HanLP

@Override
public void save(DataOutputStream out) throws Exception
  out.writeInt(id2tag.length);
  for (String tag : id2tag)
  out.writeInt(valueArray.length);
  for (FeatureFunction featureFunction : valueArray)
  out.writeInt(featureTemplateList.size());
  for (FeatureTemplate featureTemplate : featureTemplateList)
        out.writeDouble(v);

代码示例来源:origin: hankcs/HanLP

out.writeInt(m.correctionConstant);
out.writeDouble(m.correctionParam);
out.writeInt(numOutcomes);
String[] outcomeLabels = new String[numOutcomes];
m.outcomeNames = outcomeLabels;
out.writeInt(numOCTypes);
int[][] outcomePatterns = new int[numOCTypes][];
for (int i = 0; i < numOCTypes; i++)
      out.writeDouble(contextParameters[k - 1]);

代码示例来源:origin: robovm/robovm

Class<?> type = slot.getField().getType();
if (type == int.class) {
  output.writeInt(fieldValue != null ? ((Integer) fieldValue).intValue() : 0);
} else if (type == byte.class) {
  output.writeByte(fieldValue != null ? ((Byte) fieldValue).byteValue() : 0);
  output.writeFloat(fieldValue != null ? ((Float) fieldValue).floatValue() : 0);
} else if (type == double.class) {
  output.writeDouble(fieldValue != null ? ((Double) fieldValue).doubleValue() : 0);
} else {

代码示例来源:origin: robovm/robovm

if (componentType == int.class) {
  int[] intArray = (int[]) array;
  output.writeInt(intArray.length);
  for (int i = 0; i < intArray.length; i++) {
    output.writeInt(intArray[i]);
  output.writeInt(byteArray.length);
  output.write(byteArray, 0, byteArray.length);
} else if (componentType == char.class) {
  output.writeInt(doubleArray.length);
  for (int i = 0; i < doubleArray.length; i++) {
    output.writeDouble(doubleArray[i]);

代码示例来源:origin: stackoverflow.com

output.writeInt(val);
output.writeDouble(val);

代码示例来源:origin: pentaho/pentaho-kettle

dos.writeInt( getType() );
dos.writeInt( name.length() );
dos.writeInt( getLength() );
dos.writeInt( getPrecision() );
   dos.writeDouble( getNumber() );
   break;
  case VALUE_TYPE_BOOLEAN:

代码示例来源:origin: robovm/robovm

output.writeChar(field.getChar(obj));
} else if (type == double.class) {
  output.writeDouble(field.getDouble(obj));
} else if (type == float.class) {
  output.writeFloat(field.getFloat(obj));
} else if (type == int.class) {
  output.writeInt(field.getInt(obj));
} else if (type == long.class) {
  output.writeLong(field.getLong(obj));

代码示例来源:origin: pentaho/pentaho-kettle

case VALUE_TYPE_STRING:
 if ( getString() == null ) {
  dos.writeInt( -1 ); // -1 == null string
 } else {
  String string = getString();
  byte[] chars = string.getBytes( Const.XML_ENCODING );
  dos.writeInt( chars.length );
  dos.write( chars );
case VALUE_TYPE_BIGNUMBER:
 if ( getBigNumber() == null ) {
  dos.writeInt( -1 ); // -1 == null big number
 } else {
  String string = getBigNumber().toString();
 dos.writeDouble( getNumber() );
 break;
case VALUE_TYPE_BOOLEAN:

相关文章