Exemplo n.º 1
0
  public int readUShort() {
    checkRecordPosition();

    int result = LittleEndian.getUShort(data, recordOffset);
    recordOffset += LittleEndian.SHORT_SIZE;
    pos += LittleEndian.SHORT_SIZE;
    return result;
  }
Exemplo n.º 2
0
  /** This method will read a byte from the current record */
  public int read() throws IOException {
    checkRecordPosition();

    byte result = data[recordOffset];
    recordOffset += 1;
    pos += 1;
    return result;
  }
Exemplo n.º 3
0
  public long readLong() {
    checkRecordPosition();

    long result = LittleEndian.getLong(data, recordOffset);
    recordOffset += LittleEndian.LONG_SIZE;
    pos += LittleEndian.LONG_SIZE;
    return result;
  }
Exemplo n.º 4
0
  public int readInt() {
    checkRecordPosition();

    int result = LittleEndian.getInt(data, recordOffset);
    recordOffset += LittleEndian.INT_SIZE;
    pos += LittleEndian.INT_SIZE;
    return result;
  }
Exemplo n.º 5
0
  public byte readByte() {
    checkRecordPosition();

    byte result = data[recordOffset];
    recordOffset += 1;
    pos += 1;
    return result;
  }
Exemplo n.º 6
0
  public short[] readShortArray() {
    checkRecordPosition();

    short[] arr = LittleEndian.getShortArray(data, recordOffset);
    final int size = (2 * (arr.length + 1));
    recordOffset += size;
    pos += size;

    return arr;
  }
Exemplo n.º 7
0
  public double readDouble() {
    checkRecordPosition();
    // Reset NAN data
    NAN_data = null;
    double result = LittleEndian.getDouble(data, recordOffset);
    // Excel represents NAN in several ways, at this point in time we do not often
    // know the sequence of bytes, so as a hack we store the NAN byte sequence
    // so that it is not corrupted.
    if (Double.isNaN(result)) {
      NAN_data = new byte[8];
      System.arraycopy(data, recordOffset, NAN_data, 0, 8);
    }

    recordOffset += LittleEndian.DOUBLE_SIZE;
    pos += LittleEndian.DOUBLE_SIZE;
    return result;
  }