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

The following are Jave code examples for showing how to use writeShort() of the java.io.ObjectOutputStream class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jdk8u-jdk   File: Shorts.java   View Source Code Vote up 6 votes
/**
 * 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.writeShort(0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readShort();
        }
    }
}
 
Example 2
Project: openjdk-jdk10   File: Shorts.java   View Source Code Vote up 6 votes
/**
 * 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.writeShort(0);
        }
        oout.flush();
        for (int j = 0; j < ncycles; j++) {
            oin.readShort();
        }
    }
}
 
Example 3
Project: graphflow   File: SortedAdjacencyList.java   View Source Code Vote up 5 votes
/**
 * See {@link GraphDBState#serialize(String)}.
 */
public void serialize(ObjectOutputStream objectOutputStream) throws IOException {
    objectOutputStream.writeInt(size);
    objectOutputStream.writeInt(neighbourIds.length);
    objectOutputStream.writeInt(edgeTypes.length);
    objectOutputStream.writeInt(edgeIds.length);
    for (int i = 0; i < size; i++) {
        objectOutputStream.writeInt(neighbourIds[i]);
        objectOutputStream.writeShort(edgeTypes[i]);
        objectOutputStream.writeLong(edgeIds[i]);
    }
}
 
Example 4
Project: jdk8u-jdk   File: CustomObjTrees.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream 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
Project: openjdk-jdk10   File: CustomObjTrees.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream 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
Project: morpheus-core   File: SparseArrayOfZonedDateTimes.java   View Source Code Vote up 5 votes
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        final long value = getLong(index);
        os.writeLong(value);
        if (value != defaultValueAsLong) {
            final short zoneId = zoneIds.get(index);
            os.writeShort(zoneId);
        }
    }
}
 
Example 7
Project: morpheus-core   File: MappedArrayOfZonedDateTimes.java   View Source Code Vote up 5 votes
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        final int byteIndex = index * BYTE_COUNT;
        final long epochMillis = byteBuffer.getLong(byteIndex);
        final short zoneId = byteBuffer.getShort(byteIndex + 8);
        os.writeLong(epochMillis);
        os.writeShort(zoneId);
    }
}
 
Example 8
Project: morpheus-core   File: MappedArrayOfZonedDateTimes.java   View Source Code Vote up 5 votes
/** Custom serialization */
private void writeObject(ObjectOutputStream os) throws IOException {
    os.writeInt(length);
    os.writeLong(defaultValueAsLong);
    os.writeShort(defaultZoneId);
    os.writeObject(defaultValue);
    for (int i=0; i<length; ++i) {
        final int byteIndex = i * BYTE_COUNT;
        final long epochMillis = byteBuffer.getLong(byteIndex);
        final short zoneId = byteBuffer.getShort(byteIndex + 8);
        os.writeLong(epochMillis);
        os.writeShort(zoneId);
    }
}
 
Example 9
Project: morpheus-core   File: DenseArrayOfZonedDateTimes.java   View Source Code Vote up 5 votes
@Override
public final void write(ObjectOutputStream os, int[] indexes) throws IOException {
    for (int index : indexes) {
        final long value = values[index];
        os.writeLong(value);
        if (value != defaultValueAsLong) {
            os.writeShort(zoneIds[index]);
        }
    }
}
 
Example 10
Project: morpheus-core   File: DenseArrayOfZonedDateTimes.java   View Source Code Vote up 5 votes
/** Custom serialization */
private void writeObject(ObjectOutputStream os) throws IOException {
    final int length = values.length;
    os.writeInt(length);
    os.writeLong(defaultValueAsLong);
    os.writeObject(defaultValue);
    for (int i=0; i<length; ++i) {
        os.writeLong(values[i]);
        os.writeShort(zoneIds[i]);
    }
}
 
Example 11
Project: JavaStudy   File: MineC3P0DataSource.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream oos) throws IOException {
    oos.writeShort(1);
}
 
Example 12
Project: spring_mvc_template   File: DataSource.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream oos) throws IOException {
    oos.writeShort(2);
}