code: private int parseLength() throws IOException {
          int curLen = 0;
          if (dataPos == dataSize)
              return curLen;
          int lenByte = data[dataPos++] & 0xff;
          if (isIndefinite(lenByte)) {
              ndefsList.add(new Integer(dataPos));
              unresolved++;
              return curLen;
          }
          if (isLongForm(lenByte)) {
              lenByte &= LEN_MASK;
              if (lenByte > 4) {
                  throw new IOException("Too much data");
              }
              if ((dataSize - dataPos) < (lenByte + 1)) {
                  throw new IOException("Too little data");
              }
              for (int i = 0; i < lenByte; i++) {
                  curLen = (curLen << 8) + (data[dataPos++] & 0xff);
              }
              if (curLen < 0) {
                  throw new IOException("Invalid length bytes");
              }
          } else {
             curLen = (lenByte & LEN_MASK);
          }
          return curLen;
      }
docs: Parse the length and if it is an indefinite length then add
  the current position to the <code>ndefsList</code> vector.