Check if stream is currently at edit code point
@param  {BufferStreamReader}  stream
@return {Boolean}
546928
function isAtCodePoint(stream) {
	const code = stream.peek();

	// between quotes, looks like an empty attribute value
	return (isQuote(code) && getPrevCode(stream) === code)
		// between tags, e.g. > and <
		|| (code === 60 /* < */ && getPrevCode(stream) === 62 /* > */)
		// on empty line
		|| (isLineBreak(code) && reEmptyLine.test(stream.buffer.lineForRow(stream.pos.row)));
}
488664
def _check_stream(stream):
    ''''''
    if not isinstance(stream, type(_sys.stderr)):
        raise TypeError("The stream given ({}) is not a file object.".format(stream))
487071
function checkHeaders(stream, item) {
    var headers, ret = true;
    if (!stream.parsedHeaders) {
        stream.parsedHeaders = true;
        headers = stream.headers = gatherHeaders(item);
        stream.headersLength = headers.length;
    }
    if (!stream.hasWrittenHeaders) {
        stream.totalCount++;
        stream.push(Buffer.from(stream.formatter(stream.headers, true), "utf8"));
        stream.hasWrittenHeaders = true;
        ret = isHashArray(item) || !isArray(item);
    }
    return ret;
}
1280881
function checkHeaderFromStream(file, ctx) {
		file.contents.pipe(es.wait(function (err, data) {
			if (err) {
				throw err;
			}

			var bufferFile = new File({
				path: file.path,
				contents: data
			});

			checkHeaderFromBuffer(bufferFile, ctx);
		}));
	}
1182307
function hasInsertionPoint (file) {
  var token = appOptions.pageToken

  if (token !== '' && String(file.contents).indexOf(token) > -1) {
    insertionPoint = 'token'
    return true
  } else if (token !== '' && token !== defaults.pageToken) {
    logger('Token not found in ' + file.relative)
  }

  var soup = new Soup(String(file.contents))

  // Append after metas
  soup.setInnerHTML('head > meta:last-of-type', function (oldHTML) {
    if (oldHTML !== null) {
      insertionPoint = 'meta'
      return oldHTML
    }
  })

  if (insertionPoint) {
    return true
  }

  // Else, prepend before links
  soup.setInnerHTML('head > link:first-of-type', function (oldHTML) {
    if (oldHTML !== null) {
      insertionPoint = 'link'
      return oldHTML
    }
  })

  if (insertionPoint) {
    return true
  }

  // Else, append to head
  soup.setInnerHTML('head', function (oldHTML) {
    if (oldHTML !== null) {
      insertionPoint = 'head'
      return oldHTML
    }
  })

  return insertionPoint
}
823982
function writeIfPossible(stream) {
    if (
      // we don't have a count or a time set,
      (!settings.count && !settings.time) ||
      // the count has been met
      (settings.count && cache.length === settings.count)
    ) {
      flushCache(stream);

      return;
    }

    if (settings.time && !timeout) {
      flushCacheTimed(stream, _.noop);
    }
  }
149610
boolean hasReceivedReply(int streamId) {
        StreamState state = activeStreams.get(streamId);
        return state != null && state.hasReceivedReply();
    }
1204162
function matchProgress (stream, line) {
  if (isEmpty(line)) {
    return null
  }
  const match = line.match(BODY_PROGRESS)
  if (match) {
    return {
      percent: Number.parseInt(match.groups.percent),
      fileCount: Number.parseInt(match.groups.fileCount),
      file: normalizePath(match.groups.file)
    }
  }
  return null
}
1140451
function ChunkStreamWithStream(stream, options) {
  ChunkStream.call(this, options);

  stream.pause(); // Pause stream and wait for data listener. It's useful for node v0.8
  this._stream = stream;
  this._stream.on('end', this.end.bind(this)); // Should catch the end event for node v0.8
}
112714
function isFormData(obj) {
    return Object.keys(obj).some((key) => {
        if (obj[key] instanceof stream.Stream) return true;
        if (Buffer.isBuffer(obj[key])) return true;
        return false;
    });
}
741143
function pause (stream) {
  var events = []
  var onData = createEventListener('data', events)
  var onEnd = createEventListener('end', events)

  // buffer data
  stream.on('data', onData)

  // buffer end
  stream.on('end', onEnd)

  return {
    end: function end () {
      stream.removeListener('data', onData)
      stream.removeListener('end', onEnd)
    },
    resume: function resume () {
      this.end()

      for (var i = 0; i < events.length; i++) {
        stream.emit.apply(stream, events[i])
      }
    }
  }
}
1050798
private boolean before() throws IOException {
        if (closed) {
            throw new IOException("Attempted read from closed stream.");
        }
        switch (length) {
            case EOF:
                return false;
            case UNKNOWN:
                length = readLength();
                pos = 0;
                if (length == EOF) {
                    HeaderList.parse(src); // result is ignored
                    return false;
                }
                return true;
            default:
                return true;
        }
    }
1365591
function(content) {
			if (!reHasComment.test(content)) {
				return content;
			}

			var stream = stringStream(content);
			var replaceRanges = [];
			var ch, ch2;

			while ((ch = stream.next())) {
				if (ch === '/') {
					ch2 = stream.peek();
					if (ch2 === '*') { // multiline CSS comment
						stream.start = stream.pos - 1;

						if (stream.skipTo('*/')) {
							stream.pos += 2;
						} else {
							// unclosed comment
							stream.skipToEnd();
						}

						replaceRanges.push([stream.start, stream.pos]);
					} else if (ch2 === '/') {
						// preprocessor’s single line comments
						stream.start = stream.pos - 1;
						while ((ch2 = stream.next())) {
							if (ch2 === '\n' || ch2 == '\r') {
								break
							}
						}

						replaceRanges.push([stream.start, stream.pos]);
					}
				} else {
					stream.skipQuoted();
				}
			}

			return utils.replaceWith(content, replaceRanges, ' ');
		}
415005
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);
    }
308551
function isReadableStream (stream) {
  return stream !== null
    && typeof (stream) === 'object'
    && typeof (stream.pipe) === 'function'
    && typeof (stream._read) === 'function'
    && typeof (stream._readableState) === 'object'
    && stream.readable !== false
}
1064579
protected function checkStream()
    {
        // Find document content type
        while ( !feof( $this->stream ) )
        {
            $line = fgets( $this->stream );

            // Check if we found a new document definition
            if ( !preg_match( '(^Content-Type:\\s+(?P<type>[a-z*][a-z0-9_/*+.-]*)(;\s*(?P<options>.*))?$)', trim( $line ), $match ) )
            {
                continue;
            }

            $type    = $match['type'];
            $options = isset( $match['options'] ) ? preg_split( '(\s*;\s*)', $match['options'] ) : array();
            foreach ( $options as $option )
            {
                if ( preg_match( '(^(?P<key>[a-z-]+)=("?)(?P<value>.*?)\\2$)', $option, $match ) )
                {
                    $this->options[$match['key']] = $match['value'];
                }
            }

            if ( $type !== 'multipart/mixed' )
            {
                throw new phpillowMultipartParserException( 'This handler does only understand "multipart/mixed" documents.' );
            }

            break;
        }

        // Search for first starting boundary
        while ( !feof( $this->stream ) )
        {
            if ( trim( fgets( $this->stream ) ) === '--' . $this->options['boundary'] )
            {
                break;
            }
        }
    }
1127344
function Atok (options) {
  if (!(this instanceof Atok))
    return new Atok(options)

  // Possible events are defined at instanciation for better performance
  EV.call(this, Atok.events)
  this.writable = true
  this.readable = true

  // Options
  options = options || {}
  this._encoding = null
  if (options.encoding) this.setEncoding( options.encoding )

  // Initializations
  // Debug flag
  this.debugMode = false

  // Status flags
  this.ended = false        // Flag indicating stream has ended
  this.ending = false       // Set when end() invokes write()
  this.paused = false       // Flag indicating stream is paused
  this.needDrain = false    // Flag indicating stream needs drain

//var keepRules = false
//include("Atok_properties.js")

//include("Atok_rule_properties.js")


  this._defaultProps = Object.keys(this)
    .filter(function (prop) {
      return /^_p_/.test(prop) && !/(continueOnFail|nextIndex)$/.test(prop)
    })
    .map(function (prop) {
      return prop.substr(3)
    })
}