Java Code Examples for java.io.ObjectOutput#writeFloat()

The following examples show how to use java.io.ObjectOutput#writeFloat() . 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: IgniteComputeConfigVariationsFullApiTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param out Out.
 * @param isVal boolean value.
 * @param bVal byte value.
 * @param cVal char value.
 * @param sVal short value.
 * @param intVal int value.
 * @param lVal long value.
 * @param fltVal float value.
 * @param dblVal double value.
 * @param strVal String value.
 * @param arrVal Array value.
 * @param eVal Enum value.
 * @throws IOException If failed.
 */
private static void writeJobState(ObjectOutput out, boolean isVal, byte bVal, char cVal, short sVal,
    int intVal, long lVal, float fltVal, double dblVal, String strVal, Object[] arrVal,
    TestJobEnum eVal) throws IOException {
    out.writeBoolean(isVal);
    out.writeByte(bVal);
    out.writeChar(cVal);
    out.writeShort(sVal);
    out.writeInt(intVal);
    out.writeLong(lVal);
    out.writeFloat(fltVal);
    out.writeDouble(dblVal);
    out.writeObject(strVal);
    out.writeObject(arrVal);
    out.writeObject(eVal);
}
 
Example 2
Source File: MixMessage.java    From incubator-hivemall with Apache License 2.0 6 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeByte(event.getID());
    out.writeObject(feature);
    out.writeFloat(weight);
    out.writeFloat(covariance);
    out.writeShort(clock);
    out.writeInt(deltaUpdates);
    out.writeBoolean(cancelRequest);
    if (groupID == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        out.writeUTF(groupID);
    }
}
 
Example 3
Source File: UnicastRef.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Marshal value to an ObjectOutput sink using RMI's serialization
 * format for parameters or return values.
 */
protected static void marshalValue(Class<?> type, Object value,
                                   ObjectOutput out)
    throws IOException
{
    if (type.isPrimitive()) {
        if (type == int.class) {
            out.writeInt(((Integer) value).intValue());
        } else if (type == boolean.class) {
            out.writeBoolean(((Boolean) value).booleanValue());
        } else if (type == byte.class) {
            out.writeByte(((Byte) value).byteValue());
        } else if (type == char.class) {
            out.writeChar(((Character) value).charValue());
        } else if (type == short.class) {
            out.writeShort(((Short) value).shortValue());
        } else if (type == long.class) {
            out.writeLong(((Long) value).longValue());
        } else if (type == float.class) {
            out.writeFloat(((Float) value).floatValue());
        } else if (type == double.class) {
            out.writeDouble(((Double) value).doubleValue());
        } else {
            throw new Error("Unrecognized primitive type: " + type);
        }
    } else {
        out.writeObject(value);
    }
}
 
Example 4
Source File: ExternObjTrees.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput 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 5
Source File: UnicastRef.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Marshal value to an ObjectOutput sink using RMI's serialization
 * format for parameters or return values.
 */
protected static void marshalValue(Class<?> type, Object value,
                                   ObjectOutput out)
    throws IOException
{
    if (type.isPrimitive()) {
        if (type == int.class) {
            out.writeInt(((Integer) value).intValue());
        } else if (type == boolean.class) {
            out.writeBoolean(((Boolean) value).booleanValue());
        } else if (type == byte.class) {
            out.writeByte(((Byte) value).byteValue());
        } else if (type == char.class) {
            out.writeChar(((Character) value).charValue());
        } else if (type == short.class) {
            out.writeShort(((Short) value).shortValue());
        } else if (type == long.class) {
            out.writeLong(((Long) value).longValue());
        } else if (type == float.class) {
            out.writeFloat(((Float) value).floatValue());
        } else if (type == double.class) {
            out.writeDouble(((Double) value).doubleValue());
        } else {
            throw new Error("Unrecognized primitive type: " + type);
        }
    } else {
        out.writeObject(value);
    }
}
 
Example 6
Source File: Long2DoubleOpenHashTable.java    From incubator-hivemall with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(@Nonnull ObjectOutput out) throws IOException {
    out.writeFloat(_loadFactor);
    out.writeFloat(_growFactor);
    out.writeInt(_used);
    out.writeDouble(_defaultReturnValue);

    final IMapIterator i = entries();
    while (i.next() != -1) {
        out.writeLong(i.getKey());
        out.writeDouble(i.getValue());
    }
}
 
Example 7
Source File: LineSegmentf.java    From JOML with MIT License 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeFloat(aX);
    out.writeFloat(aY);
    out.writeFloat(aZ);
    out.writeFloat(bX);
    out.writeFloat(bY);
    out.writeFloat(bZ);
}
 
Example 8
Source File: ExternObjTrees.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput 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 9
Source File: THash.java    From blip with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // LOAD FACTOR
    out.writeFloat(_loadFactor);

    // AUTO COMPACTION LOAD FACTOR
    out.writeFloat(_autoCompactionFactor);
}
 
Example 10
Source File: ExternObjTrees.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput 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
Source File: UnicastRef.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Marshal value to an ObjectOutput sink using RMI's serialization
 * format for parameters or return values.
 */
protected static void marshalValue(Class<?> type, Object value,
                                   ObjectOutput out)
    throws IOException
{
    if (type.isPrimitive()) {
        if (type == int.class) {
            out.writeInt(((Integer) value).intValue());
        } else if (type == boolean.class) {
            out.writeBoolean(((Boolean) value).booleanValue());
        } else if (type == byte.class) {
            out.writeByte(((Byte) value).byteValue());
        } else if (type == char.class) {
            out.writeChar(((Character) value).charValue());
        } else if (type == short.class) {
            out.writeShort(((Short) value).shortValue());
        } else if (type == long.class) {
            out.writeLong(((Long) value).longValue());
        } else if (type == float.class) {
            out.writeFloat(((Float) value).floatValue());
        } else if (type == double.class) {
            out.writeDouble(((Double) value).doubleValue());
        } else {
            throw new Error("Unrecognized primitive type: " + type);
        }
    } else {
        out.writeObject(value);
    }
}
 
Example 12
Source File: SimplePerson.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(personNum);
    out.writeObject(firstName);
    out.writeObject(lastName);
    out.writeShort(age);
    out.writeBoolean(married);
    out.writeLong(height);
    out.writeFloat(weight);
    out.writeObject(birthDate);
    out.writeObject(phones);
}
 
Example 13
Source File: UnicastRef.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Marshal value to an ObjectOutput sink using RMI's serialization
 * format for parameters or return values.
 */
protected static void marshalValue(Class<?> type, Object value,
                                   ObjectOutput out)
    throws IOException
{
    if (type.isPrimitive()) {
        if (type == int.class) {
            out.writeInt(((Integer) value).intValue());
        } else if (type == boolean.class) {
            out.writeBoolean(((Boolean) value).booleanValue());
        } else if (type == byte.class) {
            out.writeByte(((Byte) value).byteValue());
        } else if (type == char.class) {
            out.writeChar(((Character) value).charValue());
        } else if (type == short.class) {
            out.writeShort(((Short) value).shortValue());
        } else if (type == long.class) {
            out.writeLong(((Long) value).longValue());
        } else if (type == float.class) {
            out.writeFloat(((Float) value).floatValue());
        } else if (type == double.class) {
            out.writeDouble(((Double) value).doubleValue());
        } else {
            throw new Error("Unrecognized primitive type: " + type);
        }
    } else {
        out.writeObject(value);
    }
}
 
Example 14
Source File: ExternObjTrees.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput 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 15
Source File: Rayf.java    From JOML with MIT License 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeFloat(oX);
    out.writeFloat(oY);
    out.writeFloat(oZ);
    out.writeFloat(dX);
    out.writeFloat(dY);
    out.writeFloat(dZ);
}
 
Example 16
Source File: Long2IntOpenHashTable.java    From incubator-hivemall with Apache License 2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeFloat(_loadFactor);
    out.writeFloat(_growFactor);
    out.writeInt(_used);
    out.writeInt(_defaultReturnValue);

    final IMapIterator itor = entries();
    while (itor.next() != -1) {
        out.writeLong(itor.getKey());
        out.writeInt(itor.getValue());
    }
}
 
Example 17
Source File: Vector4f.java    From JOML with MIT License 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeFloat(x);
    out.writeFloat(y);
    out.writeFloat(z);
    out.writeFloat(w);
}
 
Example 18
Source File: GridClientNodeMetricsBean.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(lastUpdateTime);
    out.writeInt(maxActiveJobs);
    out.writeInt(curActiveJobs);
    out.writeFloat(avgActiveJobs);
    out.writeInt(maxWaitingJobs);
    out.writeInt(curWaitingJobs);
    out.writeFloat(avgWaitingJobs);
    out.writeInt(maxRejectedJobs);
    out.writeInt(curRejectedJobs);
    out.writeFloat(avgRejectedJobs);
    out.writeInt(maxCancelledJobs);
    out.writeInt(curCancelledJobs);
    out.writeFloat(avgCancelledJobs);
    out.writeInt(totalRejectedJobs);
    out.writeInt(totalCancelledJobs);
    out.writeInt(totalExecutedJobs);
    out.writeLong(maxJobWaitTime);
    out.writeLong(curJobWaitTime);
    out.writeDouble(avgJobWaitTime);
    out.writeLong(maxJobExecTime);
    out.writeLong(curJobExecTime);
    out.writeDouble(avgJobExecTime);
    out.writeInt(totalExecTasks);
    out.writeLong(totalIdleTime);
    out.writeLong(curIdleTime);
    out.writeInt(availProcs);
    out.writeDouble(load);
    out.writeDouble(avgLoad);
    out.writeDouble(gcLoad);
    out.writeLong(heapInit);
    out.writeLong(heapUsed);
    out.writeLong(heapCommitted);
    out.writeLong(heapMax);
    out.writeLong(nonHeapInit);
    out.writeLong(nonHeapUsed);
    out.writeLong(nonHeapCommitted);
    out.writeLong(nonHeapMax);
    out.writeLong(upTime);
    out.writeLong(startTime);
    out.writeLong(nodeStartTime);
    out.writeInt(threadCnt);
    out.writeInt(peakThreadCnt);
    out.writeLong(startedThreadCnt);
    out.writeInt(daemonThreadCnt);
    out.writeLong(fileSysFreeSpace);
    out.writeLong(fileSysTotalSpace);
    out.writeLong(fileSysUsableSpace);
    out.writeLong(lastDataVer);
    out.writeInt(sentMsgsCnt);
    out.writeLong(sentBytesCnt);
    out.writeInt(rcvdMsgsCnt);
    out.writeLong(rcvdBytesCnt);
}
 
Example 19
Source File: EJBRequest.java    From tomee with Apache License 2.0 4 votes vote down vote up
/**
 * Changes to this method must observe the optional {@link #metaData} version
 */
protected void writeMethodParameters(final ObjectOutput out, final Class[] types, final Object[] args) throws IOException {

    out.writeByte(types.length);

    for (int i = 0; i < types.length; i++) {
        final Class clazz = types[i];
        Object obj = args[i];

        if (clazz.isPrimitive()) {
            if (clazz == Byte.TYPE) {
                out.write(BYTE);
                final byte bytevalue = (Byte) obj;
                out.writeByte(bytevalue);

            } else if (clazz == Character.TYPE) {
                out.write(CHAR);
                final char charvalue = (Character) obj;
                out.writeChar(charvalue);

            } else if (clazz == Integer.TYPE) {
                out.write(INT);
                final int intvalue = (Integer) obj;
                out.writeInt(intvalue);

            } else if (clazz == Boolean.TYPE) {
                out.write(BOOLEAN);
                final boolean booleanvalue = (Boolean) obj;
                out.writeBoolean(booleanvalue);

            } else if (clazz == Long.TYPE) {
                out.write(LONG);
                final long longvalue = (Long) obj;
                out.writeLong(longvalue);

            } else if (clazz == Float.TYPE) {
                out.write(FLOAT);
                final float fvalue = (Float) obj;
                out.writeFloat(fvalue);

            } else if (clazz == Double.TYPE) {
                out.write(DOUBLE);
                final double dvalue = (Double) obj;
                out.writeDouble(dvalue);

            } else if (clazz == Short.TYPE) {
                out.write(SHORT);
                final short shortvalue = (Short) obj;
                out.writeShort(shortvalue);

            } else {
                throw new IOException("Unkown primitive type: " + clazz);
            }
        } else {
            if (InstanceOf.isRemote(obj)) {
                obj = Corbas.toStub(obj);
            }
            out.write(OBJECT);
            out.writeObject(clazz);
            out.writeObject(obj);
        }
    }
}
 
Example 20
Source File: AxisAngle4f.java    From JOML with MIT License 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeFloat(angle);
    out.writeFloat(x);
    out.writeFloat(y);
    out.writeFloat(z);
}