BidirectionalStream.Builder
public
static
abstract
class
BidirectionalStream.Builder
extends Object
java.lang.Object | |
↳ | android.net.http.BidirectionalStream.Builder |
Builder for BidirectionalStream
s. Allows configuring stream before constructing
it via Builder#build
.
Summary
Public constructors | |
---|---|
Builder()
|
Public methods | |
---|---|
abstract
BidirectionalStream.Builder
|
addHeader(String header, String value)
Adds a request header. |
abstract
BidirectionalStream
|
build()
Creates a |
abstract
BidirectionalStream.Builder
|
setDelayRequestHeadersUntilFirstFlushEnabled(boolean delayRequestHeadersUntilFirstFlush)
Sets whether to delay sending request headers until |
abstract
BidirectionalStream.Builder
|
setHttpMethod(String method)
Sets the HTTP method for the request. |
abstract
BidirectionalStream.Builder
|
setPriority(int priority)
Sets priority of the stream which should be one of the |
abstract
BidirectionalStream.Builder
|
setTrafficStatsTag(int tag)
Sets |
abstract
BidirectionalStream.Builder
|
setTrafficStatsUid(int uid)
Sets specific UID to use when accounting socket traffic caused by this request. |
Inherited methods | |
---|---|
Public constructors
Public methods
addHeader
public abstract BidirectionalStream.Builder addHeader (String header, String value)
Adds a request header. Returns builder to facilitate chaining.
Parameters | |
---|---|
header |
String : the header name
This value cannot be null . |
value |
String : the header value
This value cannot be null . |
Returns | |
---|---|
BidirectionalStream.Builder |
the builder to facilitate chaining
This value cannot be null . |
build
public abstract BidirectionalStream build ()
Creates a BidirectionalStream
using configuration from this Builder
. The
returned BidirectionalStream
can then be started by calling BidirectionalStream.start()
.
Returns | |
---|---|
BidirectionalStream |
constructed BidirectionalStream using configuration from this Builder
This value cannot be null . |
setDelayRequestHeadersUntilFirstFlushEnabled
public abstract BidirectionalStream.Builder setDelayRequestHeadersUntilFirstFlushEnabled (boolean delayRequestHeadersUntilFirstFlush)
Sets whether to delay sending request headers until BidirectionalStream#flush()
is called. This flag is currently only respected when QUIC is negotiated.
When true, QUIC will send request header frame along with data frame(s)
as a single packet when possible.
Parameters | |
---|---|
delayRequestHeadersUntilFirstFlush |
boolean : if true, sending request headers will be
delayed
until flush() is called. |
Returns | |
---|---|
BidirectionalStream.Builder |
the builder to facilitate chaining.
This value cannot be null . |
setHttpMethod
public abstract BidirectionalStream.Builder setHttpMethod (String method)
Sets the HTTP method for the request. Returns builder to facilitate chaining.
Parameters | |
---|---|
method |
String : the method to use for request. Default is 'POST'
This value cannot be null . |
Returns | |
---|---|
BidirectionalStream.Builder |
the builder to facilitate chaining
This value cannot be null . |
setPriority
public abstract BidirectionalStream.Builder setPriority (int priority)
Sets priority of the stream which should be one of the STREAM_PRIORITY_*
values. The stream is given BidirectionalStream.STREAM_PRIORITY_MEDIUM
priority
if this method is not called.
Parameters | |
---|---|
priority |
int : priority of the stream which should be one of the STREAM_PRIORITY_* values.
Value is BidirectionalStream.STREAM_PRIORITY_IDLE , BidirectionalStream.STREAM_PRIORITY_LOWEST , BidirectionalStream.STREAM_PRIORITY_LOW , BidirectionalStream.STREAM_PRIORITY_MEDIUM , or BidirectionalStream.STREAM_PRIORITY_HIGHEST |
Returns | |
---|---|
BidirectionalStream.Builder |
the builder to facilitate chaining.
This value cannot be null . |
setTrafficStatsTag
public abstract BidirectionalStream.Builder setTrafficStatsTag (int tag)
Sets TrafficStats
tag to use when accounting socket traffic caused by
this request. See TrafficStats
for more information. If no tag is
set (e.g. this method isn't called), then Android accounts for the socket traffic caused
by this request as if the tag value were set to 0.
NOTE:Setting a tag disallows sharing of sockets with requests with other tags, which may adversely effect performance by prohibiting connection sharing. In other words use of multiplexed sockets (e.g. HTTP/2 and QUIC) will only be allowed if all requests have the same socket tag.
Parameters | |
---|---|
tag |
int : the tag value used to when accounting for socket traffic caused by this
request. Tags between 0xFFFFFF00 and 0xFFFFFFFF are reserved and used
internally by system services like DownloadManager when
performing traffic on behalf of an application. |
Returns | |
---|---|
BidirectionalStream.Builder |
the builder to facilitate chaining.
This value cannot be null . |
setTrafficStatsUid
public abstract BidirectionalStream.Builder setTrafficStatsUid (int uid)
Sets specific UID to use when accounting socket traffic caused by this request. See
TrafficStats
for more information. Designed for use when performing
an operation on behalf of another application. Caller must hold
android.Manifest.permission#MODIFY_NETWORK_ACCOUNTING
permission. By default
traffic is attributed to UID of caller.
NOTE:Setting a UID disallows sharing of sockets with requests with other UIDs, which may adversely effect performance by prohibiting connection sharing. In other words use of multiplexed sockets (e.g. HTTP/2 and QUIC) will only be allowed if all requests have the same UID set.
Parameters | |
---|---|
uid |
int : the UID to attribute socket traffic caused by this request. |
Returns | |
---|---|
BidirectionalStream.Builder |
the builder to facilitate chaining.
This value cannot be null . |