Java Code Examples for com.google.common.io.LittleEndianDataInputStream#readShort()

The following examples show how to use com.google.common.io.LittleEndianDataInputStream#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: KdbxSerializer.java    From KeePassJava2 with Apache License 2.0 5 votes vote down vote up
private static int getInt(LittleEndianDataInputStream ledis) throws IOException {
    short fieldLength = ledis.readShort();
    if (fieldLength != 4) {
        throw new IllegalStateException("Int required but length was " + fieldLength);
    }
    return ledis.readInt();
}
 
Example 2
Source File: KdbxSerializer.java    From KeePassJava2 with Apache License 2.0 5 votes vote down vote up
private static long getLong(LittleEndianDataInputStream ledis) throws IOException {
    short fieldLength = ledis.readShort();
    if (fieldLength != 8) {
        throw new IllegalStateException("Long required but length was " + fieldLength);
    }
    return ledis.readLong();
}
 
Example 3
Source File: KdbxSerializer.java    From KeePassJava2 with Apache License 2.0 4 votes vote down vote up
private static byte [] getByteArray(LittleEndianDataInputStream ledis) throws IOException {
    short fieldLength = ledis.readShort();
    byte [] value = new byte[fieldLength];
    ledis.readFully(value);
    return value;
}