當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectOutputStream.writeInt方法代碼示例

本文整理匯總了Java中java.io.ObjectOutputStream.writeInt方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectOutputStream.writeInt方法的具體用法?Java ObjectOutputStream.writeInt怎麽用?Java ObjectOutputStream.writeInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.ObjectOutputStream的用法示例。


在下文中一共展示了ObjectOutputStream.writeInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeParameters

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
@Override
public void writeParameters(ObjectOutputStream objectOutputStream) throws IOException
{
    objectOutputStream.writeInt(this.requestList.size());
    for (Object aRequestList : this.requestList)
    {
        //if (CAUSE_RANDOM_ERROR) if (Math.random() > ERROR_RATE) throw new IOException("Random error, for testing only!");
        objectOutputStream.writeObject(aRequestList);
    }
}
 
開發者ID:goldmansachs,項目名稱:jrpip,代碼行數:11,代碼來源:ThankYouWriter.java

示例2: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/** Custom serialization */
private void writeObject(ObjectOutputStream os) throws IOException {
    os.writeInt(length);
    os.writeInt(defaultValue);
    for (int i=0; i<length; ++i) {
        final int value = getInt(i);
        os.writeInt(value);
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:10,代碼來源:MappedArrayOfInts.java

示例3: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * @serialData the number of distinct keys, and then for each distinct key:
 *     the first key, the number of values for that key, and the key's values,
 *     followed by successive keys and values from the entries() ordering
 */
@GwtIncompatible // java.io.ObjectOutputStream
private void writeObject(ObjectOutputStream stream) throws IOException {
  stream.defaultWriteObject();
  stream.writeInt(size());
  for (Entry<K, V> entry : entries()) {
    stream.writeObject(entry.getKey());
    stream.writeObject(entry.getValue());
  }
}
 
開發者ID:paul-hammant,項目名稱:googles-monorepo-demo,代碼行數:15,代碼來源:LinkedListMultimap.java

示例4: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Override writeObject.
 * See http://docs.oracle.com/javase/6/docs/api/java/io/ObjectOutputStream.html
 */
private void writeObject(ObjectOutputStream stream) throws IOException{
    if (defaultCenturyStart == null) {
        // if defaultCenturyStart is not yet initialized,
        // calculate and set value before serialization.
        initializeDefaultCenturyStart(defaultCenturyBase);
    }
    initializeTimeZoneFormat(false);
    stream.defaultWriteObject();
    stream.writeInt(getContext(DisplayContext.Type.CAPITALIZATION).value());
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:15,代碼來源:SimpleDateFormat.java

示例5: writeSupportVectors

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/** Writes the example set into the given output stream. */
public void writeSupportVectors(ObjectOutputStream out) throws IOException {
	out.writeInt(getNumberOfSupportVectors());
	out.writeDouble(b);
	out.writeInt(dim);
	if ((meanVarianceMap == null) || (meanVarianceMap.size() == 0)) {
		out.writeUTF("noscale");
	} else {
		out.writeUTF("scale");
		out.writeInt(meanVarianceMap.size());
		Iterator i = meanVarianceMap.keySet().iterator();
		while (i.hasNext()) {
			Integer index = (Integer) i.next();
			MeanVariance meanVariance = meanVarianceMap.get(index);
			out.writeInt(index.intValue());
			out.writeDouble(meanVariance.getMean());
			out.writeDouble(meanVariance.getVariance());
		}
	}
	for (int e = 0; e < train_size; e++) {
		if (alphas[e] != 0.0d) {
			out.writeInt(atts[e].length);
			for (int a = 0; a < atts[e].length; a++) {
				out.writeInt(index[e][a]);
				out.writeDouble(atts[e][a]);
			}
			out.writeDouble(alphas[e]);
			out.writeDouble(ys[e]);
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:32,代碼來源:SVMExamples.java

示例6: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream oos)
		throws IOException {
		    //List<byte[]> txs = new ArrayList<byte[]>();
		    //List<Integer> intList = new ArrayList<Integer>();
	System.out.println("serialize proof message, appearedinchainheight is " + this.appearedInChainheight);
	oos.writeInt(appearedInChainheight);
	oos.writeObject(sp);
	for(Integer i : this.outputIndices) {
		oos.writeObject(i);
	}
	for(Transaction tx : this.validationPath) {
		oos.writeObject(tx.bitcoinSerialize());
	}

}
 
開發者ID:kit-tm,項目名稱:bitnym,代碼行數:16,代碼來源:ProofMessage.java

示例7: serializeMainFile

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
@Override
public void serializeMainFile(ObjectOutputStream objectOutputStream) throws IOException {
    objectOutputStream.writeInt(data.length);
    objectOutputStream.writeLong(nextIDNeverYetAssigned);
    objectOutputStream.writeByte(nextBucketOffset);
    objectOutputStream.writeInt(nextBucketId);
    objectOutputStream.writeInt(nextPartitionId);
    objectOutputStream.writeInt(recycledIdsSize);
    objectOutputStream.writeObject(recycledIds);
}
 
開發者ID:graphflow,項目名稱:graphflow,代碼行數:11,代碼來源:EdgeStore.java

示例8: saveStats

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Saves the statistics logged so far
 */
protected static void saveStats(){
	JFileChooser chooser = new JFileChooser();
	chooser.setFileFilter(new FileNameExtensionFilter("Keys per second statistics file", "kpsstats"));
	chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
	if(chooser.showSaveDialog(null) != JFileChooser.APPROVE_OPTION){
		return;
	}
	File file = new File(chooser.getSelectedFile().getAbsolutePath().endsWith(".kpsstats") ? chooser.getSelectedFile().getAbsolutePath() : (chooser.getSelectedFile().getAbsolutePath() + ".kpsstats"));
	if(!file.exists() || (file.exists() && JOptionPane.showConfirmDialog(null, "File already exists, overwrite?", "Keys per second", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)){
		try {
			file.createNewFile();
			ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
			out.writeInt(TotPanel.hits);
			out.writeDouble(avg);
			out.writeInt(max);
			out.writeLong(n);
			out.writeInt(prev);
			out.writeInt(tmp.get());
			for(Entry<Integer, Key> key : keys.entrySet()){
				out.writeInt(key.getKey());
				out.writeObject(key.getValue());
			}
			out.flush();
			out.close();
			JOptionPane.showMessageDialog(null, "Statistics succesfully saved", "Keys per second", JOptionPane.INFORMATION_MESSAGE);
		} catch (IOException e) {e.printStackTrace();
		JOptionPane.showMessageDialog(null, "Failed to save the statistics!", "Keys per second", JOptionPane.ERROR_MESSAGE);
		}
	}
}
 
開發者ID:RoanH,項目名稱:KeysPerSecond,代碼行數:34,代碼來源:Main.java

示例9: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/** Custom serialization */
private void writeObject(ObjectOutputStream os) throws IOException {
    final int length = values.length;
    os.writeInt(length);
    os.writeLong(defaultValueAsLong);
    os.writeObject(defaultValue);
    for (int i=0; i<length; ++i) {
        os.writeLong(values[i]);
        os.writeShort(zoneIds[i]);
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:12,代碼來源:DenseArrayOfZonedDateTimes.java

示例10: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(lockContentionMonitoringEnabled);
    out.writeInt(nProfiledThreadsLimit);
    out.writeInt(stackDepthLimit);
    out.writeInt(samplingInterval);
    out.writeInt(objAllocStackSamplingInterval);
    out.writeInt(objAllocStackSamplingDepth);
    out.writeBoolean(runGCOnGetResultsInMemoryProfiling);
    out.writeBoolean(waitTrackingEnabled);
    out.writeBoolean(sleepTrackingEnabled);
    out.writeBoolean(threadsSamplingEnabled);
    out.writeInt(threadsSamplingFrequency);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:SetChangeableInstrParamsCommand.java

示例11: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
void writeObject(ObjectOutputStream out) throws IOException {
    out.writeInt(instrType);
    out.writeInt(classNames.length);

    for (int i = 0; i < classNames.length; i++) {
        out.writeUTF(classNames[i]);
    }

    out.writeBoolean(instrSpawnedThreads);
    out.writeBoolean(startProfilingPointsActive);
    out.writeObject(profilingPointIDs);
    out.writeObject(profilingPointHandlers);
    out.writeObject(profilingPointInfos);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:InitiateProfilingCommand.java

示例12: writeMapTo

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
void writeMapTo(ObjectOutputStream out) throws IOException {
  out.writeInt(delegate.size());
  for (Entry<K, V> entry : delegate.entrySet()) {
    out.writeObject(entry.getKey());
    out.writeObject(entry.getValue());
  }
  out.writeObject(null); // terminate entries
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:9,代碼來源:MapMakerInternalMap.java

示例13: doWrite

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
public  void doWrite( ObjectOutputStream stream )
    throws IOException
{
    // write the IOR to the ObjectOutputStream
    stream.writeInt(typeData.length);
    stream.write(typeData);
    stream.writeInt(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        stream.writeInt(profileTags[i]);
        stream.writeInt(profileData[i].length);
        stream.write(profileData[i]);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:StubIORImpl.java

示例14: write

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        final int value = getInt(index);
        os.writeInt(value);
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:8,代碼來源:SparseArrayWithIntCoding.java

示例15: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Provides serialization support.
 *
 * @param stream  the output stream.
 *
 * @throws IOException  if there is an I/O error.
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    stream.writeInt(this.store.size());
    Set keys = this.store.keySet();
    Iterator iterator = keys.iterator();
    while (iterator.hasNext()) {
        Comparable key = (Comparable) iterator.next();
        stream.writeObject(key);
        Paint paint = getPaint(key);
        SerialUtilities.writePaint(paint, stream);
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:PaintMap.java


注:本文中的java.io.ObjectOutputStream.writeInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。