Java Code Examples for java.io.ObjectInputStream#readShort()

The following examples show how to use java.io.ObjectInputStream#readShort() . 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: Shorts.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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
Source File: CustomObjTrees.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 3
Source File: Shorts.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 4
Source File: Shorts.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 5
Source File: CustomObjTrees.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 6
Source File: CustomObjTrees.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 7
Source File: CustomObjTrees.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 8
Source File: CustomObjTrees.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 9
Source File: Shorts.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 10
Source File: Shorts.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 11
Source File: Shorts.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 12
Source File: CustomObjTrees.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 13
Source File: Shorts.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 14
Source File: CustomObjTrees.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    z = in.readBoolean();
    b = in.readByte();
    c = in.readChar();
    s = in.readShort();
    i = in.readInt();
    f = in.readFloat();
    j = in.readLong();
    d = in.readDouble();
    str = (String) in.readObject();
    parent = in.readObject();
    left = in.readObject();
    right = in.readObject();
}
 
Example 15
Source File: DenseArrayOfZonedDateTimes.java    From morpheus-core with Apache License 2.0 5 votes vote down vote up
@Override
public final void read(ObjectInputStream is, int count) throws IOException {
    for (int i=0; i<count; ++i) {
        final long value = is.readLong();
        this.values[i] = value;
        if (value != defaultValueAsLong) {
            this.zoneIds[i] = is.readShort();
        }
    }
}
 
Example 16
Source File: KDERunner.java    From geowave with Apache License 2.0 5 votes vote down vote up
private void readObject(final ObjectInputStream aInputStream)
    throws ClassNotFoundException, IOException {
  final byte[] adapterBytes = new byte[aInputStream.readShort()];
  aInputStream.readFully(adapterBytes);
  final byte[] indexBytes = new byte[aInputStream.readShort()];
  aInputStream.readFully(indexBytes);
  newAdapter = (RasterDataAdapter) PersistenceUtils.fromBinary(adapterBytes);
  index = (Index) PersistenceUtils.fromBinary(indexBytes);
  writableSerializer = newAdapter.createWritableSerializer();
}
 
Example 17
Source File: SparseArrayOfZonedDateTimes.java    From morpheus-core with Apache License 2.0 5 votes vote down vote up
@Override
public final void read(ObjectInputStream is, int count) throws IOException {
    for (int i=0; i<count; ++i) {
        final long value = is.readLong();
        this.values.put(i, value);
        if (value != defaultValueAsLong) {
            final short zoneId = is.readShort();
            this.zoneIds.put(i, zoneId);
        }
    }
}
 
Example 18
Source File: MemberBox.java    From openbd-core with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Reads an array of parameter types from the stream.
 */
private static Class<?>[] readParameters(ObjectInputStream in)
    throws IOException, ClassNotFoundException
{
    Class<?>[] result = new Class[in.readShort()];
    for (int i=0; i < result.length; i++) {
        if (!in.readBoolean()) {
            result[i] = (Class<?>) in.readObject();
            continue;
        }
        result[i] = primitives[in.readByte()];
    }
    return result;
}
 
Example 19
Source File: RasterTileResizeHelper.java    From geowave with Apache License 2.0 5 votes vote down vote up
private void readObject(final ObjectInputStream aInputStream)
    throws ClassNotFoundException, IOException {
  final byte[] adapterBytes = new byte[aInputStream.readUnsignedShort()];
  aInputStream.readFully(adapterBytes);
  final byte[] indexBytes = new byte[aInputStream.readUnsignedShort()];
  aInputStream.readFully(indexBytes);
  newAdapter = (RasterDataAdapter) PersistenceUtils.fromBinary(adapterBytes);
  index = (Index) PersistenceUtils.fromBinary(indexBytes);
  oldAdapterId = aInputStream.readShort();
  newAdapterId = aInputStream.readShort();
  indexNames = new String[] {index.getName()};
}
 
Example 20
Source File: AbstractProcessInstanceMarshaller.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public NodeInstance readNodeInstance(MarshallerReaderContext context,
        NodeInstanceContainer nodeInstanceContainer,
        WorkflowProcessInstance processInstance) throws IOException {
    ObjectInputStream stream = context.stream;
    String id = stream.readUTF();
    long nodeId = stream.readLong();
    int nodeType = stream.readShort();
    NodeInstanceImpl nodeInstance = readNodeInstanceContent(nodeType,
            stream, context, processInstance);

    nodeInstance.setNodeId(nodeId);
    nodeInstance.setNodeInstanceContainer(nodeInstanceContainer);
    nodeInstance.setProcessInstance((org.jbpm.workflow.instance.WorkflowProcessInstance) processInstance);
    nodeInstance.setId(id);

    switch (nodeType) {
        case PersisterEnums.COMPOSITE_NODE_INSTANCE:
        case PersisterEnums.DYNAMIC_NODE_INSTANCE:
            int nbVariables = stream.readInt();
            if (nbVariables > 0) {
                Context variableScope = ((org.jbpm.process.core.Process) ((org.jbpm.process.instance.ProcessInstance)
            		processInstance).getProcess()).getDefaultContext(VariableScope.VARIABLE_SCOPE);
                VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance).getContextInstance(variableScope);
                for (int i = 0; i < nbVariables; i++) {
                    String name = stream.readUTF();
                    try {
                        Object value = stream.readObject();
                        variableScopeInstance.internalSetVariable(name, value);
                    } catch (ClassNotFoundException e) {
                        throw new IllegalArgumentException("Could not reload variable " + name);
                    }
                }
            }
            while (stream.readShort() == PersisterEnums.NODE_INSTANCE) {
                readNodeInstance(context,
                        (CompositeContextNodeInstance) nodeInstance,
                        processInstance);
            }
            
            int exclusiveGroupInstances = stream.readInt();
        	for (int i = 0; i < exclusiveGroupInstances; i++) {
                ExclusiveGroupInstance exclusiveGroupInstance = new ExclusiveGroupInstance();
                ((org.jbpm.process.instance.ProcessInstance) processInstance).addContextInstance(ExclusiveGroup.EXCLUSIVE_GROUP, exclusiveGroupInstance);
                int nodeInstances = stream.readInt();
                for (int j = 0; j < nodeInstances; j++) {
                    String nodeInstanceId = stream.readUTF();
                    NodeInstance groupNodeInstance = processInstance.getNodeInstance(nodeInstanceId);
                    if (groupNodeInstance == null) {
                    	throw new IllegalArgumentException("Could not find node instance when deserializing exclusive group instance: " + nodeInstanceId);
                    }
                    exclusiveGroupInstance.addNodeInstance(groupNodeInstance);
                }
        	}

            break;
        case PersisterEnums.FOR_EACH_NODE_INSTANCE:
            while (stream.readShort() == PersisterEnums.NODE_INSTANCE) {
                readNodeInstance(context,
                        (ForEachNodeInstance) nodeInstance,
                        processInstance);
            }
            break;
        default:
        // do nothing
    }

    return nodeInstance;
}