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