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

pack-priv Class ResponseContent

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.ArrayList, .Collections, .List, java.util.function.Consumer, java.net.http.HttpHeaders, .HttpResponse, jdk.internal.net.http.common.Logger, .Utils

Implements chunked/fixed transfer encodings of HTTP/1.1 responses. Call pushBody() to read the body (blocking). Data and errors are provided to given Consumers. After final buffer delivered, empty optional delivered

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static interface
pack-priv class
pack-priv static enum
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
pack-priv final long
pack-priv static final int
private final String
pack-priv final HttpHeaders
pack-priv static final int
pack-priv static final int
private final Runnable
pack-priv final HttpResponse.BodySubscriber<?>

Constructor Summary

AccessConstructor and Description
pack-priv
ResponseContent(HttpConnection connection, long contentLength, HttpHeaders h, HttpResponse.BodySubscriber<?> userSubscriber, Runnable onFinished)

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv ResponseContent.BodyParser
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

chunkedContentback to summary
private boolean chunkedContent
chunkedContentInitializedback to summary
private boolean chunkedContentInitialized
contentLengthback to summary
pack-priv final long contentLength
CRback to summary
pack-priv static final int CR
dbgTagback to summary
private final String dbgTag
headersback to summary
pack-priv final HttpHeaders headers
LFback to summary
pack-priv static final int LF
MAX_CHUNK_HEADER_SIZEback to summary
pack-priv static final int MAX_CHUNK_HEADER_SIZE
onFinishedback to summary
private final Runnable onFinished
pusherback to summary
pack-priv final HttpResponse.BodySubscriber<?> pusher

Constructor Detail

ResponseContentback to summary
pack-priv ResponseContent(HttpConnection connection, long contentLength, HttpHeaders h, HttpResponse.BodySubscriber<?> userSubscriber, Runnable onFinished)

Method Detail

contentChunkedback to summary
pack-priv boolean contentChunked() throws IOException
getBodyParserback to summary
pack-priv ResponseContent.BodyParser getBodyParser(Consumer<Throwable> onComplete) throws IOException
jdk.internal.net.http back to summary

pack-priv Interface ResponseContent.BodyParser

extends Consumer<ByteBuffer>
Known Direct Implementers
jdk.internal.net.http.ResponseContent.ChunkedBodyParser, jdk.internal.net.http.ResponseContent.UnknownLengthBodyParser, jdk.internal.net.http.ResponseContent.FixedLengthBodyParser

Method Summary

Modifier and TypeMethod and Description
public String
public void
public void
Inherited from java.util.function.Consumer:
acceptandThen

Method Detail

currentStateMessageback to summary
public String currentStateMessage()
onErrorback to summary
public void onError(Throwable t)
onSubscribeback to summary
public void onSubscribe(AbstractSubscription sub)
jdk.internal.net.http back to summary

pack-priv Class ResponseContent.ChunkedBodyParser

extends Object
implements BodyParser
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.ResponseContent.BodyParser, java.util.function.Consumer

Field Summary

Modifier and TypeField and Description
pack-priv volatile int
pack-priv volatile int
pack-priv volatile int
pack-priv volatile int
pack-priv volatile Throwable
pack-priv volatile boolean
pack-priv final String
pack-priv final Logger
pack-priv volatile int
pack-priv final Consumer<Throwable>
pack-priv volatile int
pack-priv final ByteBuffer
pack-priv volatile ResponseContent.ChunkState
pack-priv volatile AbstractSubscription

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
accept(ByteBuffer b)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.

public String
pack-priv String
private void
public void
public void
private int
toDigit(int b)

private int
private boolean
private int
pack-priv ByteBuffer
tryReadOneHunk(ByteBuffer chunk)

Returns a ByteBuffer containing chunk of data or a "hunk" of data (a chunk of a chunk if the chunk size is larger than our ByteBuffers).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesremainingback to summary
pack-priv volatile int bytesremaining
bytesToConsumeback to summary
pack-priv volatile int bytesToConsume
chunkextback to summary
pack-priv volatile int chunkext
chunklenback to summary
pack-priv volatile int chunklen
closedExceptionallyback to summary
pack-priv volatile Throwable closedExceptionally
crback to summary
pack-priv volatile boolean cr
dbgTagback to summary
pack-priv final String dbgTag
debugback to summary
pack-priv final Logger debug
digitsback to summary
pack-priv volatile int digits
onCompleteback to summary
pack-priv final Consumer<Throwable> onComplete
partialChunklenback to summary
pack-priv volatile int partialChunklen
READMOREback to summary
pack-priv final ByteBuffer READMORE
stateback to summary
pack-priv volatile ResponseContent.ChunkState state
subback to summary
pack-priv volatile AbstractSubscription sub

Constructor Detail

ChunkedBodyParserback to summary
pack-priv ChunkedBodyParser(Consumer<Throwable> onComplete)

Method Detail

acceptback to summary
public void accept(ByteBuffer b)

Implements java.util.function.Consumer.accept.

Doc from java.util.function.Consumer.accept.

Performs this operation on the given argument.

Annotations
@Override
currentStateMessageback to summary
public String currentStateMessage()

Implements jdk.internal.net.http.ResponseContent.BodyParser.currentStateMessage.

Annotations
@Override
dbgStringback to summary
pack-priv String dbgString()
debugBufferback to summary
private void debugBuffer(ByteBuffer b)
onErrorback to summary
public void onError(Throwable t)

Implements jdk.internal.net.http.ResponseContent.BodyParser.onError.

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(AbstractSubscription sub)

Implements jdk.internal.net.http.ResponseContent.BodyParser.onSubscribe.

Annotations
@Override
toDigitback to summary
private int toDigit(int b) throws IOException
tryConsumeBytesback to summary
private int tryConsumeBytes(ByteBuffer chunkbuf) throws IOException
tryPushOneHunkback to summary
private boolean tryPushOneHunk(ByteBuffer b, List<ByteBuffer> out) throws IOException
tryReadChunkLenback to summary
private int tryReadChunkLen(ByteBuffer chunkbuf) throws IOException
tryReadOneHunkback to summary
pack-priv ByteBuffer tryReadOneHunk(ByteBuffer chunk) throws IOException

Returns a ByteBuffer containing chunk of data or a "hunk" of data (a chunk of a chunk if the chunk size is larger than our ByteBuffers). If the given chunk does not have enough data this method return an empty ByteBuffer (READMORE). If we encounter the final chunk (an empty chunk) this method returns null.

jdk.internal.net.http back to summary

pack-priv final Enum ResponseContent.ChunkState

extends Enum<ResponseContent.ChunkState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ResponseContent.ChunkState
public static final ResponseContent.ChunkState
public static final ResponseContent.ChunkState

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

DONEback to summary
public static final ResponseContent.ChunkState DONE
READING_DATAback to summary
public static final ResponseContent.ChunkState READING_DATA
READING_LENGTHback to summary
public static final ResponseContent.ChunkState READING_LENGTH

Constructor Detail

ChunkStateback to summary
private ChunkState()

Method Detail

valueOfback to summary
public static ResponseContent.ChunkState valueOf(String name)
valuesback to summary
public static ResponseContent.ChunkState[] values()
jdk.internal.net.http back to summary

pack-priv Class ResponseContent.FixedLengthBodyParser

extends Object
implements BodyParser
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.ResponseContent.BodyParser, java.util.function.Consumer

Field Summary

Modifier and TypeField and Description
pack-priv volatile Throwable
pack-priv final long
pack-priv final String
pack-priv final Logger
pack-priv final Consumer<Throwable>
pack-priv volatile long
pack-priv volatile AbstractSubscription

Constructor Summary

AccessConstructor and Description
pack-priv
FixedLengthBodyParser(long contentLength, Consumer<Throwable> onComplete)

Method Summary

Modifier and TypeMethod and Description
public void
accept(ByteBuffer b)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.

public String
pack-priv String
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closedExceptionallyback to summary
pack-priv volatile Throwable closedExceptionally
contentLengthback to summary
pack-priv final long contentLength
dbgTagback to summary
pack-priv final String dbgTag
debugback to summary
pack-priv final Logger debug
onCompleteback to summary
pack-priv final Consumer<Throwable> onComplete
remainingback to summary
pack-priv volatile long remaining
subback to summary
pack-priv volatile AbstractSubscription sub

Constructor Detail

FixedLengthBodyParserback to summary
pack-priv FixedLengthBodyParser(long contentLength, Consumer<Throwable> onComplete)

Method Detail

acceptback to summary
public void accept(ByteBuffer b)

Implements java.util.function.Consumer.accept.

Doc from java.util.function.Consumer.accept.

Performs this operation on the given argument.

Annotations
@Override
currentStateMessageback to summary
public String currentStateMessage()

Implements jdk.internal.net.http.ResponseContent.BodyParser.currentStateMessage.

Annotations
@Override
dbgStringback to summary
pack-priv String dbgString()
onErrorback to summary
public void onError(Throwable t)

Implements jdk.internal.net.http.ResponseContent.BodyParser.onError.

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(AbstractSubscription sub)

Implements jdk.internal.net.http.ResponseContent.BodyParser.onSubscribe.

Annotations
@Override
jdk.internal.net.http back to summary

pack-priv Class ResponseContent.UnknownLengthBodyParser

extends Object
implements BodyParser
Class Inheritance
  • java.lang.Object
  • jdk.internal.net.http.ResponseContent.UnknownLengthBodyParser
All Implemented Interfaces
jdk.internal.net.http.ResponseContent.BodyParser, java.util.function.Consumer

Field Summary

Modifier and TypeField and Description
pack-priv volatile int
pack-priv volatile Throwable
pack-priv final String
pack-priv final Logger
pack-priv final Consumer<Throwable>
pack-priv volatile AbstractSubscription

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
accept(ByteBuffer b)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.

public void
complete()

Must be called externally when connection has closed and therefore no more bytes can be read

public String
pack-priv String
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

breceivedback to summary
pack-priv volatile int breceived
closedExceptionallyback to summary
pack-priv volatile Throwable closedExceptionally
dbgTagback to summary
pack-priv final String dbgTag
debugback to summary
pack-priv final Logger debug
onCompleteback to summary
pack-priv final Consumer<Throwable> onComplete
subback to summary
pack-priv volatile AbstractSubscription sub

Constructor Detail

UnknownLengthBodyParserback to summary
pack-priv UnknownLengthBodyParser(Consumer<Throwable> onComplete)

Method Detail

acceptback to summary
public void accept(ByteBuffer b)

Implements java.util.function.Consumer.accept.

Doc from java.util.function.Consumer.accept.

Performs this operation on the given argument.

Annotations
@Override
completeback to summary
public void complete()

Must be called externally when connection has closed and therefore no more bytes can be read

currentStateMessageback to summary
public String currentStateMessage()

Implements jdk.internal.net.http.ResponseContent.BodyParser.currentStateMessage.

Annotations
@Override
dbgStringback to summary
pack-priv String dbgString()
onErrorback to summary
public void onError(Throwable t)

Implements jdk.internal.net.http.ResponseContent.BodyParser.onError.

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(AbstractSubscription sub)

Implements jdk.internal.net.http.ResponseContent.BodyParser.onSubscribe.

Annotations
@Override