Example usage for com.google.common.io LittleEndianDataInputStream readShort

List of usage examples for com.google.common.io LittleEndianDataInputStream readShort

Introduction

In this page you can find the example usage for com.google.common.io LittleEndianDataInputStream readShort.

Prototype

@Override
public short readShort() throws IOException 

Source Link

Document

Reads a short as specified by DataInputStream#readShort() , except using little-endian byte order.

Usage

From source file:org.linguafranca.pwdb.kdbx.stream_3_1.KdbxSerializer.java

private static byte[] getByteArray(LittleEndianDataInputStream ledis) throws IOException {
    short fieldLength = ledis.readShort();
    byte[] value = new byte[fieldLength];
    ledis.readFully(value);/*from   www . j ava2s .  com*/
    return value;
}

From source file:org.linguafranca.pwdb.kdbx.stream_3_1.KdbxSerializer.java

private static int getInt(LittleEndianDataInputStream ledis) throws IOException {
    short fieldLength = ledis.readShort();
    if (fieldLength != 4) {
        throw new IllegalStateException("Int required but length was " + fieldLength);
    }/*from  ww  w . j  a  v a2  s.  c  o m*/
    return ledis.readInt();
}

From source file:org.linguafranca.pwdb.kdbx.stream_3_1.KdbxSerializer.java

private static long getLong(LittleEndianDataInputStream ledis) throws IOException {
    short fieldLength = ledis.readShort();
    if (fieldLength != 8) {
        throw new IllegalStateException("Long required but length was " + fieldLength);
    }//from   ww  w . j a va 2 s.com
    return ledis.readLong();
}