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


Java DataOutputStream.writeDouble方法代码示例

本文整理汇总了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();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:18,代码来源:ServerSparseDoubleRow.java

示例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);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:ProxyGenerator.java

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

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

示例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);
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:17,代码来源:MersenneTwister.java

示例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));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:18,代码来源:LittleEndianDataInputStreamTest.java

示例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);
	}
}
 
开发者ID:mitdbg,项目名称:imputedb,代码行数:9,代码来源:DoubleField.java

示例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);
    }
}
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:37,代码来源:CRFModel.java

示例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);
    }
}
 
开发者ID:shibing624,项目名称:crf-seg,代码行数:28,代码来源:CRFModel.java

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

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

示例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]);
		}
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:39,代码来源:WorkloadAnalysisSession.java

示例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();
}
 
开发者ID:Clout-Team,项目名称:JarCraftinator,代码行数:16,代码来源:PacketPlayOutPlayerPositionAndLook.java

示例14: save

import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void save(DataOutputStream out) throws IOException
{
    out.writeDouble(tempo);
    out.writeInt(tsBeatsPerBar);
    out.writeInt(tsBeatNoteValue);
}
 
开发者ID:SmashMaster,项目名称:KraftigAudio,代码行数:8,代码来源:SongProperties.java

示例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);
}
 
开发者ID:ForOhForError,项目名称:MTG-Card-Recognizer,代码行数:14,代码来源:ImageDesc.java


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