private synchronized int readExpectedBytes(byte[] toWrite, int lengthExpected) throws IOException {
    int curPos = 0;
    do {
      int numOfByteRead = in.read(toWrite, curPos, lengthExpected - curPos);
      if (numOfByteRead < 0) {
        return curPos;
      } else {
        curPos += numOfByteRead;
      }
    } while (curPos < lengthExpected);
    return curPos;
  }
How much of the input has the {@link RecordReader} consumed i.e.
has been processed by?

@return progress from <code>0.0</code> to <code>1.0</code>.
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/io/TeradataBinaryRecordReader.java