本文整理汇总了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);
}
}
示例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);
}
}
示例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());
}
}
示例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());
}
示例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]);
}
}
}
示例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());
}
}
示例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);
}
示例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);
}
}
}
示例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]);
}
}
示例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);
}
示例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);
}
示例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
}
示例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]);
}
}
示例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);
}
}
示例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);
}
}