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

The following examples show how to use java.io.ObjectOutput#writeChar() . 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: ExternObjTrees.java    From jdk8u_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 2
Source File: UnicastRef.java    From openjdk-8 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 3
Source File: GridMarshallerPerformanceTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@SuppressWarnings("ForLoopReplaceableByForEach")
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(intVal);
    out.writeLong(longVal);
    out.writeBoolean(boolVal);
    out.writeObject(longArr);
    out.writeObject(dblArr);

    if (MARSHAL_COLS_AS_OBJECTS) {
        out.writeObject(list);
        out.writeObject(map);
    }
    else {
        out.writeInt(list.size());

        for (int i = 0; i < list.size(); i++)
            out.writeFloat(list.get(i));

        out.writeInt(map.size());

        for (Map.Entry<Integer, Character> e : map.entrySet()) {
            out.writeInt(e.getKey());
            out.writeChar(e.getValue());
        }
    }

    out.writeObject(selfRef);
}
 
Example 4
Source File: UnicastRef.java    From jdk8u-dev-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 5
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 6
Source File: UnicastRef.java    From hottub 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 7
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 8
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 9
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 10
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 11
Source File: FixMessage.java    From TransFIX with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(major);
    out.writeInt(minor);
    out.writeInt(servicepack);
    out.writeUTF((String) type);
    out.writeObject(this.fixMsgOutput);
    out.writeChar(delim);
}
 
Example 12
Source File: ExternObjTrees.java    From openjdk-jdk8u 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 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 jdk8u60 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: UnicastRef.java    From jdk8u60 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 16
Source File: ExternObjTrees.java    From TencentKona-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 17
Source File: UnicastRef.java    From TencentKona-8 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 18
Source File: ExternObjTrees.java    From jdk8u-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 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: CharAttribute.java    From reladomo with Apache License 2.0 4 votes vote down vote up
@Override
public void serializeNonNullAggregateDataValue(Nullable valueWrappedInNullable, ObjectOutput out) throws IOException
{
    out.writeChar(((MutableCharacter)valueWrappedInNullable).getValue());
}