Example usage for org.apache.poi.util LittleEndian getUShort

List of usage examples for org.apache.poi.util LittleEndian getUShort

Introduction

In this page you can find the example usage for org.apache.poi.util LittleEndian getUShort.

Prototype

public static int getUShort(byte[] data) 

Source Link

Document

get an unsigned short value from the beginning of a byte array

Usage

From source file:com.argo.hwp.utils.HwpStreamReader.java

License:Open Source License

/**
 * unsigned 2 byte//  w ww. jav  a2s  .  c  om
 * 
 * @return
 * @throws IOException
 */
public int uint16() throws IOException {
    if (ensure(2) == 0)
        return -1;

    return LittleEndian.getUShort(buf);
}

From source file:com.argo.hwp.utils.HwpStreamReader.java

License:Open Source License

/**
 * unsigned 2 byte array//w  ww.java 2s.  c  o m
 * 
 * @param i
 * @return
 * @throws IOException
 */
public int[] uint16(int i) throws IOException {
    if (i <= 0)
        throw new IllegalArgumentException();

    int[] uints = new int[i];
    for (int ii = 0; ii < i; ii++) {
        if (ensure(2) == 0)
            throw new EOFException();

        uints[ii] = LittleEndian.getUShort(buf);
    }

    return uints;
}