java.io.ObjectInputStream#readShort ( )源码实例Demo

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

源代码1 项目: jdk8u-dev-jdk   文件: Shorts.java
/**
 * 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();
        }
    }
}
 
源代码2 项目: openjdk-8-source   文件: CustomObjTrees.java
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();
}
 
源代码3 项目: jdk8u_jdk   文件: Shorts.java
/**
 * 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();
        }
    }
}
 
源代码4 项目: jdk8u60   文件: Shorts.java
/**
 * 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();
        }
    }
}
 
源代码5 项目: jdk8u60   文件: CustomObjTrees.java
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();
}
 
源代码6 项目: jdk8u_jdk   文件: CustomObjTrees.java
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();
}
 
源代码7 项目: openjdk-jdk8u   文件: CustomObjTrees.java
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();
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: Shorts.java
/**
 * 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();
        }
    }
}
 
源代码9 项目: openjdk-8-source   文件: Shorts.java
/**
 * 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();
        }
    }
}
 
源代码10 项目: openjdk-jdk9   文件: Shorts.java
/**
 * 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();
        }
    }
}
 
源代码11 项目: openjdk-jdk9   文件: CustomObjTrees.java
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();
}
 
源代码12 项目: jdk8u-jdk   文件: Shorts.java
/**
 * 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();
        }
    }
}
 
源代码13 项目: jdk8u-jdk   文件: CustomObjTrees.java
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();
}
 
源代码14 项目: jdk8u-jdk   文件: CustomObjTrees.java
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();
}
 
源代码15 项目: geowave   文件: RasterTileResizeHelper.java
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()};
}
 
源代码16 项目: openbd-core   文件: MemberBox.java
/**
 * 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;
}
 
@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);
        }
    }
}
 
源代码18 项目: geowave   文件: KDERunner.java
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();
}
 
源代码19 项目: morpheus-core   文件: DenseArrayOfZonedDateTimes.java
@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();
        }
    }
}
 
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;
}