private int readToBuff(int count) throws IOException {
    int offset = 0;

    while (offset < count) {
      int bytesRead = in.read(buff, offset, count - offset);
      if (bytesRead == -1) {
        return bytesRead;
      }
      offset += bytesRead;
    }
    return offset;
  }
Reads a 16-bit character value from this stream.

@return the next <code>char</code> value from the source stream.

@throws IOException
          If a problem occurs reading from this DataInputStream.
ql/src/java/org/apache/hadoop/hive/ql/io/NonSyncDataInputBuffer.java