Example usage for java.io ObjectInput readShort

List of usage examples for java.io ObjectInput readShort

Introduction

In this page you can find the example usage for java.io ObjectInput readShort.

Prototype

short readShort() throws IOException;

Source Link

Document

Reads two input bytes and returns a short value.

Usage

From source file:com.splicemachine.pipeline.constraint.ConstraintContext.java

@Override
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
    short len = objectInput.readShort();
    if (len > 0) {
        messageArgs = new String[len];
        for (int i = 0; i < messageArgs.length; i++) {
            messageArgs[i] = objectInput.readUTF();
        }/*w  w  w  .j a  v a  2 s  .  co m*/
    }
}

From source file:com.delphix.session.impl.frame.SerialNumber.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    serialBits = in.readByte() & 0xff; // Unsigned byte

    if (serialBits < Byte.SIZE) {
        serialNumber = in.readByte();/*from   w w  w  .j a v a 2  s  .co  m*/
    } else if (serialBits < Short.SIZE) {
        serialNumber = in.readShort();
    } else if (serialBits < Integer.SIZE) {
        serialNumber = in.readInt();
    } else {
        serialNumber = in.readLong();
    }
}

From source file:com.weibo.api.motan.protocol.rpc.CompressRpcCodec.java

private Map<String, String> decodeRequestAttachments(ObjectInput input)
        throws IOException, ClassNotFoundException {
    int size = input.readShort();

    if (size <= 0) {
        return null;
    }//from ww  w.  j  a  v  a 2s.c o  m

    Map<String, String> attachments = new HashMap<String, String>();

    for (int i = 0; i < size; i++) {
        attachments.put(input.readUTF(), input.readUTF());
    }

    return attachments;
}