java.io.ObjectOutput#writeFloat ( )源码实例Demo

下面列出了java.io.ObjectOutput#writeFloat ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * @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);
}
 
源代码2 项目: incubator-hivemall   文件: MixMessage.java
@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);
    }
}
 
源代码3 项目: jdk8u_jdk   文件: UnicastRef.java
/**
 * 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);
    }
}
 
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());
    }
}
 
源代码5 项目: JOML   文件: Rayf.java
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);
}
 
源代码6 项目: openjdk-8   文件: ExternObjTrees.java
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);
}
 
源代码7 项目: openjdk-jdk8u   文件: UnicastRef.java
/**
 * 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);
    }
}
 
源代码8 项目: ignite   文件: SimplePerson.java
/** {@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);
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: UnicastRef.java
/**
 * 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);
    }
}
 
源代码10 项目: jdk8u-dev-jdk   文件: ExternObjTrees.java
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);
}
 
源代码11 项目: blip   文件: THash.java
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // LOAD FACTOR
    out.writeFloat(_loadFactor);

    // AUTO COMPACTION LOAD FACTOR
    out.writeFloat(_autoCompactionFactor);
}
 
源代码12 项目: openjdk-jdk9   文件: ExternObjTrees.java
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);
}
 
源代码13 项目: JOML   文件: LineSegmentf.java
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);
}
 
@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());
    }
}
 
源代码15 项目: openjdk-8-source   文件: UnicastRef.java
/**
 * 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);
    }
}
 
源代码16 项目: hottub   文件: ExternObjTrees.java
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);
}
 
源代码17 项目: tomee   文件: EJBRequest.java
/**
 * 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);
        }
    }
}
 
源代码18 项目: ignite   文件: GridClientNodeMetricsBean.java
/** {@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);
}
 
源代码19 项目: JOML   文件: Vector4f.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeFloat(x);
    out.writeFloat(y);
    out.writeFloat(z);
    out.writeFloat(w);
}
 
源代码20 项目: JOML   文件: AxisAngle4f.java
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeFloat(angle);
    out.writeFloat(x);
    out.writeFloat(y);
    out.writeFloat(z);
}