Java Code Examples for java.io.ObjectOutput.writeShort()

The following are Jave code examples for showing how to use writeShort() of the java.io.ObjectOutput class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: xcc   File: TShortArrayList.java   Source Code and License Vote up 6 votes
public void writeExternal( ObjectOutput out ) throws IOException {
	// VERSION
	out.writeByte( 0 );

	// POSITION
	out.writeInt( _pos );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );

	// ENTRIES
	int len = _data.length;
	out.writeInt( len );
	for( int i = 0; i < len; i++ ) {
		out.writeShort( _data[ i ] );
	}
}
 
Example 2
Project: HCFCore   File: TShortHashSet.java   Source Code and License Vote up 6 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {

	// VERSION
	out.writeByte( 1 );

	// SUPER
	super.writeExternal( out );

	// NUMBER OF ENTRIES
	out.writeInt( _size );

    // LOAD FACTOR -- Added version 1
    out.writeFloat( _loadFactor );

    // NO ENTRY VALUE -- Added version 1
    out.writeShort( no_entry_value );

	// ENTRIES
    for ( int i = _states.length; i-- > 0; ) {
        if ( _states[i] == FULL ) {
            out.writeShort( _set[i] );
        }
    }
}
 
Example 3
Project: openjdk-jdk10   File: UnicastRef.java   Source Code and License Vote up 5 votes
/**
 * 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
Project: xcc   File: TShortLinkedList.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // NO_ENTRY_VALUE
    out.writeShort(no_entry_value);

    // ENTRIES
    out.writeInt(size);
    for (TShortIterator iterator = iterator(); iterator.hasNext();) {
        short next = iterator.next();
        out.writeShort(next);
    }
}
 
Example 5
Project: xcc   File: TLongShortHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeLong( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );
}
 
Example 6
Project: xcc   File: TCharShortHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeChar( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );
}
 
Example 7
Project: xcc   File: TShortShortHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );
}
 
Example 8
Project: xcc   File: TShortByteHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeByte( no_entry_value );
}
 
Example 9
Project: HCFCore   File: TShortShortHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );
}
 
Example 10
Project: openjdk-jdk10   File: ExternObjTrees.java   Source Code and License Vote up 5 votes
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
Project: xcc   File: TShortDoubleHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeDouble( no_entry_value );
}
 
Example 12
Project: xcc   File: TShortIntHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeInt( no_entry_value );
}
 
Example 13
Project: HCFCore   File: TShortLongHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeLong( no_entry_value );
}
 
Example 14
Project: HCFCore   File: TDoubleShortHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeDouble( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );
}
 
Example 15
Project: HCFCore   File: TShortShortHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );
}
 
Example 16
Project: HCFCore   File: TByteShortHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeByte( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeShort( no_entry_value );
}
 
Example 17
Project: fitnotifications   File: MeasureUnit.java   Source Code and License Vote up 5 votes
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeByte(0); // version
    out.writeUTF(type);
    out.writeUTF(subType);
    out.writeShort(0); // allow for more data.
}
 
Example 18
Project: HCFCore   File: TShortDoubleHash.java   Source Code and License Vote up 5 votes
/** {@inheritDoc} */
public void writeExternal( ObjectOutput out ) throws IOException {
    // VERSION
	out.writeByte( 0 );

    // SUPER
	super.writeExternal( out );

	// NO_ENTRY_KEY
	out.writeShort( no_entry_key );

	// NO_ENTRY_VALUE
	out.writeDouble( no_entry_value );
}
 
Example 19
Project: OpenJSharp   File: UnicastRef.java   Source Code and License Vote up 5 votes
/**
 * 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 20
Project: hashsdn-controller   File: VersionedExternalizableMessage.java   Source Code and License Vote up 4 votes
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeShort(version);
}