本文整理汇总了Java中java.io.DataOutputStream.writeDouble方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutputStream.writeDouble方法的具体用法?Java DataOutputStream.writeDouble怎么用?Java DataOutputStream.writeDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataOutputStream
的用法示例。
在下文中一共展示了DataOutputStream.writeDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeTo
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override public void writeTo(DataOutputStream output) throws IOException {
try {
lock.readLock().lock();
super.writeTo(output);
output.writeInt(hashMap.size());
ObjectIterator<Int2DoubleMap.Entry> iter = hashMap.int2DoubleEntrySet().fastIterator();
Int2DoubleMap.Entry entry = null;
while (iter.hasNext()) {
entry = iter.next();
output.writeInt(entry.getIntKey());
output.writeDouble(entry.getDoubleValue());
}
} finally {
lock.readLock().unlock();
}
}
示例2: write
import java.io.DataOutputStream; //导入方法依赖的package包/类
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);
}
}
示例3: write
import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
* Write the constant to the output stream
*/
void write(Environment env, DataOutputStream out, ConstantPool tab) throws IOException {
if (num instanceof Integer) {
out.writeByte(CONSTANT_INTEGER);
out.writeInt(num.intValue());
} else if (num instanceof Long) {
out.writeByte(CONSTANT_LONG);
out.writeLong(num.longValue());
} else if (num instanceof Float) {
out.writeByte(CONSTANT_FLOAT);
out.writeFloat(num.floatValue());
} else if (num instanceof Double) {
out.writeByte(CONSTANT_DOUBLE);
out.writeDouble(num.doubleValue());
}
}
示例4: writeTo
import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
* Writes the parameter set to an output stream
*
* @param os an output stream
* @throws IOException
*/
public void writeTo(OutputStream os)
throws IOException
{
DataOutputStream dos = new DataOutputStream(os);
dos.writeInt(N);
dos.writeInt(q);
dos.writeInt(d);
dos.writeInt(d1);
dos.writeInt(d2);
dos.writeInt(d3);
dos.writeInt(B);
dos.writeDouble(beta);
dos.writeDouble(normBound);
dos.writeInt(signFailTolerance);
dos.writeInt(bitsF);
dos.writeUTF(hashAlg.getAlgorithmName());
}
示例5: writeState
import java.io.DataOutputStream; //导入方法依赖的package包/类
/** Writes the entire state of the MersenneTwister RNG to the stream. */
public synchronized void writeState(DataOutputStream stream) throws IOException {
int len = mt.length;
for (int x = 0; x < len; x++) {
stream.writeInt(mt[x]);
}
len = mag01.length;
for (int x = 0; x < len; x++) {
stream.writeInt(mag01[x]);
}
stream.writeInt(mti);
stream.writeDouble(nextNextGaussian);
stream.writeBoolean(haveNextNextGaussian);
}
示例6: initializeData
import java.io.DataOutputStream; //导入方法依赖的package包/类
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));
}
示例7: serialize
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void serialize(DataOutputStream dos) throws IOException {
if (value == null) {
dos.writeDouble(Type.MISSING_DOUBLE);
} else {
dos.writeDouble(value);
}
}
示例8: save
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void save(DataOutputStream out) throws Exception
{
out.writeInt(id2tag.length);
for (String tag : id2tag)
{
out.writeUTF(tag);
}
FeatureFunction[] valueArray = featureFunctionTrie.getValueArray(new FeatureFunction[0]);
out.writeInt(valueArray.length);
for (FeatureFunction featureFunction : valueArray)
{
featureFunction.save(out);
}
featureFunctionTrie.save(out);
out.writeInt(featureTemplateList.size());
for (FeatureTemplate featureTemplate : featureTemplateList)
{
featureTemplate.save(out);
}
if (matrix != null)
{
out.writeInt(matrix.length);
for (double[] line : matrix)
{
for (double v : line)
{
out.writeDouble(v);
}
}
}
else
{
out.writeInt(0);
}
}
示例9: save
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void save(DataOutputStream out) throws Exception {
out.writeInt(id2tag.length);
for (String tag : id2tag) {
out.writeUTF(tag);
}
FeatureFunction[] valueArray = featureFunctionTrie.getValueArray(new FeatureFunction[0]);
out.writeInt(valueArray.length);
for (FeatureFunction featureFunction : valueArray) {
featureFunction.save(out);
}
featureFunctionTrie.save(out);
out.writeInt(featureTemplateList.size());
for (FeatureTemplate featureTemplate : featureTemplateList) {
featureTemplate.save(out);
}
if (matrix != null) {
out.writeInt(matrix.length);
for (double[] line : matrix) {
for (double v : line) {
out.writeDouble(v);
}
}
} else {
out.writeInt(0);
}
}
示例10: saveMatrixData
import java.io.DataOutputStream; //导入方法依赖的package包/类
private void saveMatrixData(Observation[] obs, VariableNumber[] var, ZipOutputStream zos) {
try {
int i, j;
int size;
size = obs[0].getSize();
//save varaible mapping in a separate file
for (j = 0; j < size; j++) {
if (var[j].getType() == JWATConstants.STRING) {
saveVarMapping(var[j], zos);
}
}
//save data
zos.putNextEntry(new ZipEntry(filename + BINext));
DataOutputStream dos = new DataOutputStream(zos);
for (i = 0; i < obs.length; i++) {
dos.writeInt(obs[i].getID());
for (j = 0; j < size; j++) {
dos.writeDouble(obs[i].getIndex(j));
}
}
dos.flush();
zos.closeEntry();
} catch (IOException e) {
e.printStackTrace();
}
}
示例11: saveVarMapping
import java.io.DataOutputStream; //导入方法依赖的package包/类
private void saveVarMapping(VariableNumber var, ZipOutputStream zos) throws IOException {
zos.putNextEntry(new ZipEntry(var.getName() + "_Map" + BINext));
DataOutputStream dos = new DataOutputStream(zos);
Mapping[] map = var.getMapping().getMappingValue();
dos.write(map.length);
for (Mapping element : map) {
dos.writeDouble(element.getConversion());
dos.writeUTF(element.getValue().toString());
}
dos.flush();
zos.closeEntry();
}
示例12: saveKmeansData
import java.io.DataOutputStream; //导入方法依赖的package包/类
private void saveKmeansData(ZipOutputStream zos, KMean clustering) throws IOException {
int i, j, k;
ClusteringInfosKMean curInfo;
ClusterInfoKMean curClustInfo[];
short clustAssign[][];
DataOutputStream dos = new DataOutputStream(zos);
clustAssign = clustering.getAsseg();
for (i = 0; i < clustering.getNumCluster(); i++) {
curInfo = (ClusteringInfosKMean) clustering.getClusteringInfos(i);
dos.writeInt(curInfo.numCluster + 1);
dos.writeDouble(curInfo.omsr);
dos.writeDouble(curInfo.ratio);
curClustInfo = curInfo.infoCluster;
//Write clusters infos
for (j = 0; j < curClustInfo.length; j++) {
dos.writeInt(curInfo.numElem[j]);
for (k = 0; k < model.getMatrix().getNumVariables(); k++) {
dos.writeDouble(curClustInfo[j].percVar[k]);
dos.writeInt(curClustInfo[j].statClust[k].iNotZr);
dos.writeDouble(curClustInfo[j].statClust[k].dMedia);
dos.writeDouble(curClustInfo[j].statClust[k].dStdEr);
dos.writeDouble(curClustInfo[j].statClust[k].dStdDv);
dos.writeDouble(curClustInfo[j].statClust[k].dVarnz);
dos.writeDouble(curClustInfo[j].statClust[k].dKurto);
dos.writeDouble(curClustInfo[j].statClust[k].dSkewn);
dos.writeDouble(curClustInfo[j].statClust[k].dRange);
dos.writeDouble(curClustInfo[j].statClust[k].dMinOs);
dos.writeDouble(curClustInfo[j].statClust[k].dMaxOs);
}
}
//Write clustering assignment
for (k = 0; k < clustAssign[i].length; k++) {
dos.writeShort(clustAssign[i][k]);
}
}
}
示例13: send
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void send(DataOutputStream out) throws IOException {
byte[] packetId = VarData.getVarInt(0x2F);
byte[] teleportID = VarData.getVarInt(this.teleportID);
VarData.writeVarInt(out, packetId.length + teleportID.length + 33);
out.write(packetId);
out.writeDouble(x);
out.writeDouble(y);
out.writeDouble(z);
out.writeFloat(yaw);
out.writeFloat(pitch);
out.writeByte(flags);
out.write(teleportID);
out.flush();
}
示例14: save
import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void save(DataOutputStream out) throws IOException
{
out.writeDouble(tempo);
out.writeInt(tsBeatsPerBar);
out.writeInt(tsBeatNoteValue);
}
示例15: writeOut
import java.io.DataOutputStream; //导入方法依赖的package包/类
public void writeOut(DataOutputStream out) throws IOException
{
out.writeInt(desc.data.length);
for(BrightFeature ft:desc.data)
{
out.writeInt(ft.value.length);
for(double val:ft.value)
{
out.writeDouble(val);
}
}
hash.writeOut(out);
}