APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.net.http

pack-priv Class Http1HeaderParser

extends Object
Class Inheritance
Imports
java.io.IOException, java.net.ProtocolException, java.nio.BufferUnderflowException, .ByteBuffer, java.util.ArrayList, .HashMap, .List, .Locale, .Map, java.net.http.HttpHeaders, jdk.internal.net.http.common.Utils

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private static final char
private HttpHeaders
private static final char
private static final int
K

private static final char
private static final int
private Map<String, List<String>>
private int
private StringBuilder
private long
private static final char
private Http1HeaderParser.State
private String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
private boolean
private void
public String
currentStateMessage()

A current-state message suitable for inclusion in an exception detail message.

private char

Returns:

the next byte in the input, interpreted as an ISO-8859-1 encoded char
get
(ByteBuffer
a ByteBuffer containing a partial input
input
)

Returns a character (char) corresponding to the next byte in the input, interpreted as an ISO-8859-1 encoded character.

pack-priv HttpHeaders
headers()

Returns the headers, possibly empty.

private void
private void
private static long
newSize(long size, int name, int value)

pack-priv boolean

Returns:

true iff the end of the headers block has been reached
parse
(ByteBuffer
the ( partial ) header data
input
)

Parses HTTP/1.X status-line and headers from the given bytes.

private ProtocolException
protocolException(String format, Object... args)

private void
private void
private void
pack-priv int
responseCode()

Returns the response code.

private void
private void
private void
pack-priv String
statusLine()

Returns the status-line.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CRback to summary
private static final char CR
headersback to summary
private HttpHeaders headers
HTback to summary
private static final char HT
Kback to summary
private static final int K
LFback to summary
private static final char LF
MAX_HTTP_HEADER_SIZEback to summary
private static final int MAX_HTTP_HEADER_SIZE
privateMapback to summary
private Map<String, List<String>> privateMap
responseCodeback to summary
private int responseCode
sbback to summary
private StringBuilder sb
sizeback to summary
private long size
SPback to summary
private static final char SP
stateback to summary
private Http1HeaderParser.State state
statusLineback to summary
private String statusLine

Constructor Detail

Http1HeaderParserback to summary
pack-priv Http1HeaderParser()

Method Detail

addHeaderFromStringback to summary
private void addHeaderFromString(String headerString) throws ProtocolException
canContinueParsingback to summary
private boolean canContinueParsing(ByteBuffer buffer)
checkMaxHeaderSizeback to summary
private void checkMaxHeaderSize(int sz) throws ProtocolException
currentStateMessageback to summary
public String currentStateMessage()

A current-state message suitable for inclusion in an exception detail message.

getback to summary
private char get(ByteBuffer input)

Returns a character (char) corresponding to the next byte in the input, interpreted as an ISO-8859-1 encoded character.

The ISO-8859-1 encoding is a 8-bit character coding that corresponds to the first 256 Unicode characters - from U+0000 to U+00FF. UTF-16 is backward compatible with ISO-8859-1 - which means each byte in the input should be interpreted as an unsigned value from [0, 255] representing the character code.

Parameters
input:ByteBuffer

a ByteBuffer containing a partial input

Returns:char

the next byte in the input, interpreted as an ISO-8859-1 encoded char

Exceptions
BufferUnderflowException:
if the input buffer's current position is not smaller than its limit
headersback to summary
pack-priv HttpHeaders headers()

Returns the headers, possibly empty.

maybeEndHeadersback to summary
private void maybeEndHeaders(ByteBuffer input) throws ProtocolException
maybeStartHeadersback to summary
private void maybeStartHeaders(ByteBuffer input) throws ProtocolException
newSizeback to summary
private static long newSize(long size, int name, int value) throws ProtocolException
parseback to summary
pack-priv boolean parse(ByteBuffer input) throws ProtocolException

Parses HTTP/1.X status-line and headers from the given bytes. Must be called successive times, with additional data, until returns true. All given ByteBuffers will be consumed, until ( possibly ) the last one ( when true is returned ), which may not be fully consumed.

Parameters
input:ByteBuffer

the ( partial ) header data

Returns:boolean

true iff the end of the headers block has been reached

protocolExceptionback to summary
private ProtocolException protocolException(String format, Object... args)
readResumeHeaderback to summary
private void readResumeHeader(ByteBuffer input) throws ProtocolException
readResumeStatusLineback to summary
private void readResumeStatusLine(ByteBuffer input) throws ProtocolException
readStatusLineFeedback to summary
private void readStatusLineFeed(ByteBuffer input) throws ProtocolException
responseCodeback to summary
pack-priv int responseCode()

Returns the response code.

resumeOrEndHeadersback to summary
private void resumeOrEndHeaders(ByteBuffer input) throws ProtocolException
resumeOrLFback to summary
private void resumeOrLF(ByteBuffer input) throws ProtocolException
resumeOrSecondCRback to summary
private void resumeOrSecondCR(ByteBuffer input) throws ProtocolException
statusLineback to summary
pack-priv String statusLine()

Returns the status-line.

jdk.internal.net.http back to summary

pack-priv final Enum Http1HeaderParser.State

extends Enum<Http1HeaderParser.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State
public static final Http1HeaderParser.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Http1HeaderParser.State
public static Http1HeaderParser.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FINISHEDback to summary
public static final Http1HeaderParser.State FINISHED
HEADERback to summary
public static final Http1HeaderParser.State HEADER
HEADER_FOUND_CRback to summary
public static final Http1HeaderParser.State HEADER_FOUND_CR
HEADER_FOUND_CR_LFback to summary
public static final Http1HeaderParser.State HEADER_FOUND_CR_LF
HEADER_FOUND_CR_LF_CRback to summary
public static final Http1HeaderParser.State HEADER_FOUND_CR_LF_CR
HEADER_FOUND_LFback to summary
public static final Http1HeaderParser.State HEADER_FOUND_LF
INITIALback to summary
public static final Http1HeaderParser.State INITIAL
STATUS_LINEback to summary
public static final Http1HeaderParser.State STATUS_LINE
STATUS_LINE_ENDback to summary
public static final Http1HeaderParser.State STATUS_LINE_END
STATUS_LINE_END_CRback to summary
public static final Http1HeaderParser.State STATUS_LINE_END_CR
STATUS_LINE_END_LFback to summary
public static final Http1HeaderParser.State STATUS_LINE_END_LF
STATUS_LINE_FOUND_CRback to summary
public static final Http1HeaderParser.State STATUS_LINE_FOUND_CR
STATUS_LINE_FOUND_LFback to summary
public static final Http1HeaderParser.State STATUS_LINE_FOUND_LF

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static Http1HeaderParser.State valueOf(String name)
valuesback to summary
public static Http1HeaderParser.State[] values()