当前位置: 首页>>代码示例>>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;未经允许,请勿转载。