code: function Parser_findDefaultInlineStreamEnd(stream) {
        var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
        var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
        while ((ch = stream.getByte()) !== -1) {
          if (state === 0) {
            state = (ch === E) ? 1 : 0;
          } else if (state === 1) {
            state = (ch === I) ? 2 : 0;
          } else {
            assert(state === 2);
            if (ch === SPACE || ch === LF || ch === CR) {
              // Let's check the next five bytes are ASCII... just be sure.
              n = 5;
              followingBytes = stream.peekBytes(n);
              for (i = 0; i < n; i++) {
                ch = followingBytes[i];
                if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
                  // Not a LF, CR, SPACE or any visible ASCII character, i.e.
                  // it's binary stuff. Resetting the state.
                  state = 0;
                  break;
                }
              }
              if (state === 2) {
                break;  // Finished!
              }
            } else {
              state = 0;
            }
          }
        }
        return ((stream.pos - 4) - startPos);
      }
docs: Find the end of the stream by searching for the /EI\s/.
  @returns {number} The inline stream length.