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

The following examples show how to use java.io.ObjectInputStream#readDouble() . 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
Source File: CustomObjTrees.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 2
Source File: Doubles.java    From jdk8u-jdk with 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 3
Source File: CustomObjTrees.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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 4
Source File: Doubles.java    From jdk8u_jdk with 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 5
Source File: Doubles.java    From openjdk-jdk8u-backup with 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 6
Source File: InternalStatsResponse.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
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
Source File: Doubles.java    From openjdk-jdk8u with 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 8
Source File: Doubles.java    From openjdk-8-source with 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
Source File: SerialUtilities.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 10
Source File: Doubles.java    From dragonwell8_jdk with 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
Source File: MatrixUtils.java    From hipparchus with 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 12
Source File: TDoubleFloatHashMap.java    From gemfirexd-oss with 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();
        float val = stream.readFloat();
        put(key, val);
    }
}
 
Example 13
Source File: TDoubleIntHashMap.java    From gemfirexd-oss with 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 14
Source File: Ellipse2DSerializer.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 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 15
Source File: TDoubleDoubleHashMap.java    From gemfirexd-oss with 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();
        double val = stream.readDouble();
        put(key, val);
    }
}
 
Example 16
Source File: Line2DSerializer.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 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
Source File: SparseArrayOfDoubles.java    From morpheus-core with Apache License 2.0 5 votes vote down vote up
@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
Source File: TDoubleLongHashMap.java    From gemfirexd-oss with 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();
        long val = stream.readLong();
        put(key, val);
    }
}
 
Example 19
Source File: TDoubleIntHashMap.java    From gemfirexd-oss with 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
Source File: TDoubleObjectHashMap.java    From gemfirexd-oss with 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();
        Object val = stream.readObject();
        put(key, val);
    }
}