Java Code Examples for java.io.ObjectInputStream#readDouble()

The following examples show how to use java.io.ObjectInputStream#readDouble() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * 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 2
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 3
/**
 * Reads a <code>Point2D</code> object that has been serialised by the
 * {@link #writePoint2D(Point2D, ObjectOutputStream)} method.
 *
 * @param stream  the input stream (<code>null</code> not permitted).
 *
 * @return The point object (possibly <code>null</code>).
 *
 * @throws IOException  if there is an I/O problem.
 */
public static Point2D readPoint2D(final ObjectInputStream stream)
    throws IOException {

    if (stream == null) {
        throw new IllegalArgumentException("Null 'stream' argument.");
    }
    Point2D result = null;
    final boolean isNull = stream.readBoolean();
    if (!isNull) {
        final double x = stream.readDouble();
        final double y = stream.readDouble();
        result = new Point2D.Double(x, y);
    }
    return result;

}
 
Example 4
/**
 * 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
/**
 * 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
void readObject(ObjectInputStream in) throws IOException {
    nTotalInstrMethods = in.readInt();
    nClassLoads = in.readInt();
    nFirstMethodInvocations = in.readInt();
    nNonEmptyInstrMethodGroupResponses = in.readInt();
    nEmptyInstrMethodGroupResponses = in.readInt();
    nSingleMethodInstrMethodGroupResponses = in.readInt();
    clientInstrTime = in.readDouble();
    clientDataProcTime = in.readDouble();
    totalHotswappingTime = in.readDouble();
    averageHotswappingTime = in.readDouble();
    minHotswappingTime = in.readDouble();
    maxHotswappingTime = in.readDouble();
    methodEntryExitCallTime0 = in.readDouble();
    methodEntryExitCallTime1 = in.readDouble();
    methodEntryExitCallTime2 = in.readDouble();
}
 
Example 7
/**
 * 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 8
Source Project: jdk8u_jdk   File: Doubles.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 9
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 10
Source Project: jdk8u-jdk   File: Doubles.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 11
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    int size = stream.readInt();
    setUp(size);
    while (size-- > 0) {
        double key = stream.readDouble();
        double val = stream.readDouble();
        put(key, val);
    }
}
 
Example 12
Source Project: gemfirexd-oss   File: TDoubleIntHashMap.java    License: Apache License 2.0 5 votes vote down vote up
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    int size = stream.readInt();
    setUp(size);
    while (size-- > 0) {
        double key = stream.readDouble();
        int val = stream.readInt();
        put(key, val);
    }
}
 
Example 13
Source Project: hipparchus   File: MatrixUtils.java    License: Apache License 2.0 5 votes vote down vote up
/** Deserialize  a {@link RealMatrix} field in a class.
 * <p>
 * This method is intended to be called from within a private
 * <code>readObject</code> method (after a call to
 * <code>ois.defaultReadObject()</code>) in a class that has a
 * {@link RealMatrix} field, which should be declared <code>transient</code>.
 * This way, the default handling does not deserialize the matrix (the {@link
 * RealMatrix} interface is not serializable by default) but this method does
 * deserialize it specifically.
 * </p>
 * @param instance instance in which the field must be set up
 * @param fieldName name of the field within the class (may be private and final)
 * @param ois stream from which the real matrix should be read
 * @exception ClassNotFoundException if a class in the stream cannot be found
 * @exception IOException if object cannot be read from the stream
 * @see #serializeRealMatrix(RealMatrix, ObjectOutputStream)
 */
public static void deserializeRealMatrix(final Object instance,
                                         final String fieldName,
                                         final ObjectInputStream ois)
  throws ClassNotFoundException, IOException {
    try {

        // read the matrix data
        final int n = ois.readInt();
        final int m = ois.readInt();
        final double[][] data = new double[n][m];
        for (int i = 0; i < n; ++i) {
            final double[] dataI = data[i];
            for (int j = 0; j < m; ++j) {
                dataI[j] = ois.readDouble();
            }
        }

        // create the instance
        final RealMatrix matrix = new Array2DRowRealMatrix(data, false);

        // set up the field
        final java.lang.reflect.Field f =
            instance.getClass().getDeclaredField(fieldName);
        f.setAccessible(true);
        f.set(instance, matrix);

    } catch (NoSuchFieldException | IllegalAccessException e) {
        IOException ioe = new IOException();
        ioe.initCause(e);
        throw ioe;
    }
}
 
Example 14
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    int size = stream.readInt();
    setUp(size);
    while (size-- > 0) {
        double key = stream.readDouble();
        float val = stream.readFloat();
        put(key, val);
    }
}
 
Example 15
/**
 * Reads the object from the object input stream.
 *
 * @param in the object input stream from where to read the serialized data.
 * @return the generated object.
 * @throws IOException            if reading the stream failed.
 * @throws ClassNotFoundException if serialized object class cannot be found.
 */
public Object readObject( final ObjectInputStream in )
  throws IOException, ClassNotFoundException {
  final double x = in.readDouble();
  final double y = in.readDouble();
  final double w = in.readDouble();
  final double h = in.readDouble();
  return new Ellipse2D.Double( x, y, w, h );
}
 
Example 16
/**
 * Reads the object from the object input stream.
 *
 * @param in the object input stream from where to read the serialized data.
 * @return the generated object.
 * @throws IOException            if reading the stream failed.
 * @throws ClassNotFoundException if serialized object class cannot be found.
 */
public Object readObject( final ObjectInputStream in )
  throws IOException, ClassNotFoundException {
  final double x1 = in.readDouble();
  final double y1 = in.readDouble();
  final double x2 = in.readDouble();
  final double y2 = in.readDouble();
  return new Line2D.Double( x1, y1, x2, y2 );
}
 
Example 17
@Override
public final void read(ObjectInputStream is, int count) throws IOException {
    for (int i=0; i<count; ++i) {
        final double value = is.readDouble();
        this.setDouble(i, value);
    }
}
 
Example 18
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    int size = stream.readInt();
    setUp(size);
    while (size-- > 0) {
        double key = stream.readDouble();
        long val = stream.readLong();
        put(key, val);
    }
}
 
Example 19
Source Project: gemfirexd-oss   File: TDoubleIntHashMap.java    License: Apache License 2.0 5 votes vote down vote up
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    int size = stream.readInt();
    setUp(size);
    while (size-- > 0) {
        double key = stream.readDouble();
        int val = stream.readInt();
        put(key, val);
    }
}
 
Example 20
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    int size = stream.readInt();
    setUp(size);
    while (size-- > 0) {
        double key = stream.readDouble();
        Object val = stream.readObject();
        put(key, val);
    }
}