Read var short short.

@param optimal the optimal
@return the short
@throws IOException the io exception
9446
public short readVarShort(int optimal) throws IOException {
    int[] varShortDepths = {optimal, 16};
    final int type = (int) this.read(1).toLong();
    return (short) this.read(varShortDepths[type]).toLong();
  }
1141520
public short[] getShortArray(final String key) {
		final String[] value = getArray(key);
		if (value != null) {
			final short[] result = new short[value.length];
			for (int i = 0; i < value.length; i++) {
				result[i] = Short.parseShort(value[i]);
			}
			return result;
		}
		return null;
	}
510469
public static short readShortLittleEndian(InputStream io) throws IOException {
		int value = io.read();
		if (value < 0) throw new EOFException();
		int i = io.read();
		if (i < 0) throw new EOFException();
		return (short)(value | (i << 8));
	}
1275505
public static short readShort(byte b[], int offset) {
    int retValue;

    retValue = b[offset++] << 8;
    retValue |= b[offset] & 0xff;

    return (short)retValue;
  }
446512
public static Short getShort(Map<?, ?> map, Object key) {
		return get(map, key, Short.class);
	}
1336968
public static short readShort(byte[] array, int offset) {
    // First make integers to resolve signed vs. unsigned issues.
    int b0 = array[offset + 0] & 0xFF;
    int b1 = array[offset + 1] & 0xFF;
    return (short) ((b0 << 8) + (b1 << 0));
  }
1061224
public static int readUnsignedVarint(ByteBuffer buffer) throws IOException {
    int val = 0;
    int bits = 0;
    while(true) {
      final int data = buffer.get();
      val |= (data & 0x7F) << bits;
      if((data & 0x80) == 0) {
        return val;
      }
      bits += 7;
      if(bits > 35) {
        throw new IOException("Variable length quantity is too long for expected integer.");
      }
    }
  }
1111930
private short readShort() throws IOException {
    latestRead =
      (short)SerializationUtils.readIntegerType(input, WriterImpl.SHORT_BYTE_SIZE,
                                                true, input.useVInts());
    return latestRead;
  }
945229
public int[] readInts (int length, boolean optimizePositive) throws KryoException {
		if (varEncoding) {
			int[] array = new int[length];
			for (int i = 0; i < length; i++)
				array[i] = readVarInt(optimizePositive);
			return array;
		}
		return readInts(length);
	}
1329694
public static short readShort(byte[] buf, int pos) {
    checkBoundary(buf, pos, 2);
    return (short) (((short) (buf[pos] & 0xff) << 8) | ((short) (buf[pos + 1] & 0xff)));
  }
1049838
public int getShort(int offset)
  {
    int b0 = getCode()[offset + 0] & 0xff;
    int b1 = getCode()[offset + 1] & 0xff;
    
    return (short) ((b0 << 8) + b1);
  }
174873
public short getShort(String key) {
    if (containsKey(key)) {
      return Short.parseShort(get(key));
    } else {
      throw new IllegalArgumentException("Missing key " + key + ".");
    }
  }
816676
public short getShort(String property) {
    return getProperty(property, value -> {
      try {
        return Short.valueOf(value);
      } catch (NumberFormatException e) {
        throw new ConfigurationException("malformed property value: " + property + " must be a short");
      }
    });
  }
1034044
public static short readShort(ArrayView source, int position) {
        return (short) ((source.get(position) & 0xFF) << 8
                | (source.get(position + 1) & 0xFF));
    }
1092938
public short getShort( String key )
        throws MissingResourceException
    {
        ResourceBundle bundle = getBundle();
        String value = bundle.getString( key );
        try
        {
            return Short.parseShort( value );
        }
        catch( NumberFormatException nfe )
        {
            throw new MissingResourceException( "Expecting a short value but got " + value,
                                                "java.lang.String",
                                                key
            );
        }
    }
808870
public static final short readShort(byte[] array, int offset)
    {
        if (array.length < offset + 2)
        {
            throw new IllegalArgumentException("no room in array");
        }
        return 
                (short) (((array[offset]<<8) & 0xff00) +
                (array[offset + 1] & 0xff ));
    }
502407
private int readVarInt(int firstByte) throws IOException {
        // VarInt uses the high-order bit of the last octet as a marker; some (but not all) 5-byte VarInts can fit
        // into a Java int.
        // To validate overflows we accumulate the VarInt in a long and then check if it can be represented by an int
        //
        // see http://amzn.github.io/ion-docs/docs/binary.html#varuint-and-varint-fields

        long retValue = 0;
        int b = firstByte;
        boolean isNegative = false;

        for (;;) {
            if (b < 0) throwUnexpectedEOFException();
            if ((b & 0x40) != 0) {
                isNegative = true;
            }

            retValue = (b & 0x3F);
            if ((b & 0x80) != 0) break;

            if ((b = read()) < 0) throwUnexpectedEOFException();
            retValue = (retValue << 7) | (b & 0x7F);
            if ((b & 0x80) != 0) break;
            // for the rest, they're all the same


            if ((b = read()) < 0) throwUnexpectedEOFException();
            retValue = (retValue << 7) | (b & 0x7F);
            if ((b & 0x80) != 0) break;
            // for the rest, they're all the same

            if ((b = read()) < 0) throwUnexpectedEOFException();
            retValue = (retValue << 7) | (b & 0x7F);
            if ((b & 0x80) != 0) break;
            // for the rest, they're all the same

            if ((b = read()) < 0) throwUnexpectedEOFException();
            retValue = (retValue << 7) | (b & 0x7F);
            if ((b & 0x80) != 0) break;

            // Don't support anything above a 5-byte VarInt for now, see https://github.com/amzn/ion-java/issues/146
            throwVarIntOverflowException();
        }

        if (isNegative) {
            retValue = -retValue;
        }

        int retValueAsInt = (int) retValue;
        if (retValue != ((long) retValueAsInt)) {
            throwVarIntOverflowException();
        }

        return retValueAsInt;
    }