Java Code Examples for java.io.ObjectOutputStream.writeDouble()

The following are Jave code examples for showing how to use writeDouble() of the java.io.ObjectOutputStream class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: InternalStatsResponse.java   View Source Code Vote up 6 votes
void writeObject(ObjectOutputStream out) throws IOException {
    out.writeInt(nTotalInstrMethods);
    out.writeInt(nClassLoads);
    out.writeInt(nFirstMethodInvocations);
    out.writeInt(nNonEmptyInstrMethodGroupResponses);
    out.writeInt(nEmptyInstrMethodGroupResponses);
    out.writeInt(nSingleMethodInstrMethodGroupResponses);
    out.writeDouble(clientInstrTime);
    out.writeDouble(clientDataProcTime);
    out.writeDouble(totalHotswappingTime);
    out.writeDouble(averageHotswappingTime);
    out.writeDouble(minHotswappingTime);
    out.writeDouble(maxHotswappingTime);
    out.writeDouble(methodEntryExitCallTime0);
    out.writeDouble(methodEntryExitCallTime1);
    out.writeDouble(methodEntryExitCallTime2);
}
 
Example 2
Project: incubator-netbeans   File: CalibrationDataResponse.java   View Source Code Vote up 6 votes
void writeObject(ObjectOutputStream out) throws IOException {
    int len = methodEntryExitCallTime.length;
    out.writeInt(len);

    for (int i = 0; i < len; i++) {
        out.writeDouble(methodEntryExitCallTime[i]);
    }

    for (int i = 0; i < len; i++) {
        out.writeDouble(methodEntryExitInnerTime[i]);
    }

    for (int i = 0; i < len; i++) {
        out.writeDouble(methodEntryExitOuterTime[i]);
    }

    out.writeLong(timerCountsInSecond[0]);
    out.writeLong(timerCountsInSecond[1]);
}
 
Example 3
Project: Pogamut3   File: LevelGeometry.java   View Source Code Vote up 6 votes
protected void writeNode(ObjectOutputStream out, IConstBspNode<ArrayList<Triangle>, AxisAlignedPlane3D> node, HashMap<Triangle, Integer> triangleToIndexMap ) throws IOException {
   	out.writeBoolean( node.isInternal() );
	if ( node.isInternal() ) {
		IConstBspInternalNode<ArrayList<Triangle>, AxisAlignedPlane3D> internalNode = node.asInternal();
		out.writeInt( internalNode.getBoundary().axis.ordinal() );
		out.writeDouble( internalNode.getBoundary().origin );
		writeNode( out, internalNode.getNegativeChild(), triangleToIndexMap );
		writeNode( out, internalNode.getPositiveChild(), triangleToIndexMap );
	} else {
		ArrayList<Triangle> triangles = node.asLeaf().getData();
		out.writeInt( triangles.size() );
		for ( Triangle triangle : triangles ) {
			out.writeInt( triangleToIndexMap.get(triangle) );
		}
	}
}
 
Example 4
Project: jdk8u-jdk   File: Doubles.java   View Source Code Vote up 6 votes
/**
 * Run benchmark for given number of batches, with given number of cycles
 * for each batch.
 */
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
            StreamBuffer sbuf, int nbatches, int ncycles)
    throws Exception
{
    for (int i = 0; i < nbatches; i++) {
        sbuf.reset();
        for (int j = 0; j < ncycles; j++) {
            oout.writeDouble(0.0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readDouble();
        }
    }
}
 
Example 5
Project: openjdk-jdk10   File: Doubles.java   View Source Code Vote up 6 votes
/**
 * Run benchmark for given number of batches, with given number of cycles
 * for each batch.
 */
void doReps(ObjectOutputStream oout, ObjectInputStream oin,
            StreamBuffer sbuf, int nbatches, int ncycles)
    throws Exception
{
    for (int i = 0; i < nbatches; i++) {
        sbuf.reset();
        for (int j = 0; j < ncycles; j++) {
            oout.writeDouble(0.0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readDouble();
        }
    }
}
 
Example 6
Project: rapidminer   File: SVMExamples.java   View Source Code Vote up 5 votes
/** 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]);
		}
	}
}
 
Example 7
Project: Pogamut3   File: RaycastDataFileTools.java   View Source Code Vote up 5 votes
static void save( List<PrecomputedRaycastResult> data, String fileName ) {
	try {
		ObjectOutputStream raycastDataFile = new ObjectOutputStream( new FileOutputStream("DM-Flux2_raycastDump.bin") );
		
		for (PrecomputedRaycastResult result : data ) {
			raycastDataFile.writeObject(result.request.from);
			raycastDataFile.writeObject(result.request.to);
			raycastDataFile.writeDouble(result.hitDistance);
		}
		
		raycastDataFile.close();
	} catch (IOException e) {
		fail("Failed to save data.");
	}
}
 
Example 8
Project: KeysPerSecond   File: Main.java   View Source Code Vote up 5 votes
/**
 * 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);
		}
	}
}
 
Example 9
Project: oma-riista-android   File: GameHarvest.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    out.writeLong(mCoordinates != null ? mCoordinates.first : -1);
    out.writeLong(mCoordinates != null ? mCoordinates.second : -1);

    out.writeUTF(mLocation != null ? mLocation.getProvider() : null);
    out.writeDouble(mLocation != null ? mLocation.getLatitude() : -1);
    out.writeDouble(mLocation != null ? mLocation.getLongitude() : -1);
    out.writeFloat(mLocation != null ? mLocation.getAccuracy() : -1);
    out.writeDouble(mLocation != null ? mLocation.getAltitude() : -1);
}
 
Example 10
Project: jdk8u-jdk   File: CustomObjTrees.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
Example 11
Project: openjdk-jdk10   File: CustomObjTrees.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
Example 12
Project: morpheus-core   File: SparseArrayOfDoubles.java   View Source Code Vote up 5 votes
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        final double value = getDouble(index);
        os.writeDouble(value);
    }
}
 
Example 13
Project: morpheus-core   File: MappedArrayOfDoubles.java   View Source Code Vote up 5 votes
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        final double value = getDouble(index);
        os.writeDouble(value);
    }
}
 
Example 14
Project: morpheus-core   File: MappedArrayOfDoubles.java   View Source Code Vote up 5 votes
/** Custom serialization */
private void writeObject(ObjectOutputStream os) throws IOException {
    os.writeInt(length);
    os.writeDouble(defaultValue);
    for (int i=0; i<length; ++i) {
        final double value = getDouble(i);
        os.writeDouble(value);
    }
}
 
Example 15
Project: morpheus-core   File: DenseArrayOfDoubles.java   View Source Code Vote up 5 votes
/** Custom serialization */
private void writeObject(ObjectOutputStream os) throws IOException {
    os.writeInt(values.length);
    for (double value : values) {
        os.writeDouble(value);
    }
}
 
Example 16
Project: rapidminer   File: PlattParameters.java   View Source Code Vote up 4 votes
void writeParameters(ObjectOutputStream out) throws IOException {
	out.writeDouble(this.a);
	out.writeDouble(this.b);
}
 
Example 17
Project: morpheus-core   File: DenseArrayOfDoubles.java   View Source Code Vote up 4 votes
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        os.writeDouble(values[index]);
    }
}