# Class HttpHeaderParser

java.lang.Object
org.apache.tomcat.util.http.parser.HttpHeaderParser

public class HttpHeaderParser extends Object
Parses HTTP request and response headers from a byte buffer.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`HttpHeaderParser.HeaderDataSource`
Provides access to the header data buffer for the parser.
`static enum`
`HttpHeaderParser.HeaderParsePosition`
Possible parser positions during header parsing.
`static enum`
`HttpHeaderParser.HeaderParseStatus`
Possible return values from `parseHeader()`.

## Constructor Summary

Constructors
Constructor
Description
`HttpHeaderParser(HttpHeaderParser.HeaderDataSource source, MimeHeaders headers, boolean tolerantEol)`
Creates a new header parser.

## Method Summary

Modifier and Type
Method
Description
`HttpHeaderParser.HeaderParseStatus`
`parseHeader()`
Parse an HTTP header.
`void`
`recycle()`
Resets the parser state for reuse.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HttpHeaderParser

public HttpHeaderParser(HttpHeaderParser.HeaderDataSource source, MimeHeaders headers, boolean tolerantEol)
Creates a new header parser.

Parameters:
  `source` - The data source for header bytes
  `headers` - The mime headers to populate
  `tolerantEol` - Whether to tolerate non-standard line endings

## Method Details

### recycle

public void recycle()
Resets the parser state for reuse.

### parseHeader

public HttpHeaderParser.HeaderParseStatus parseHeader() throws IOException
Parse an HTTP header.

Returns:
  One of `HttpHeaderParser.HeaderParseStatus.NEED_MORE_DATA`, `HttpHeaderParser.HeaderParseStatus.HAVE_MORE_HEADERS` or `HttpHeaderParser.HeaderParseStatus.DONE`.
Throws:
  `IOException` - If an error occurs during the parsing of the headers