public interface FrameWriter extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
ackSettings(Settings peerSettings)
Informs the peer that we've applied its latest settings.
|
void |
connectionPreface()
HTTP/2 only.
|
void |
data(boolean outFinished,
int streamId,
okio.Buffer source,
int byteCount)
source.length may be longer than the max length of the variant's data frame. |
void |
flush()
SPDY/3 only.
|
void |
goAway(int lastGoodStreamId,
ErrorCode errorCode,
byte[] debugData)
Tell the peer to stop creating streams and that we last processed
lastGoodStreamId , or zero if no streams were processed. |
void |
headers(int streamId,
List<Header> headerBlock) |
int |
maxDataLength()
The maximum size of bytes that may be sent in a single call to
data(boolean, int, okio.Buffer, int) . |
void |
ping(boolean ack,
int payload1,
int payload2)
Send a connection-level ping to the peer.
|
void |
pushPromise(int streamId,
int promisedStreamId,
List<Header> requestHeaders)
HTTP/2 only.
|
void |
rstStream(int streamId,
ErrorCode errorCode) |
void |
settings(Settings okHttpSettings)
Write okhttp's settings to the peer.
|
void |
synReply(boolean outFinished,
int streamId,
List<Header> headerBlock) |
void |
synStream(boolean outFinished,
boolean inFinished,
int streamId,
int associatedStreamId,
List<Header> headerBlock) |
void |
windowUpdate(int streamId,
long windowSizeIncrement)
Inform peer that an additional
windowSizeIncrement bytes can be
sent on streamId , or the connection if streamId is zero. |
void connectionPreface() throws IOException
IOException
void ackSettings(Settings peerSettings) throws IOException
IOException
void pushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders) throws IOException
A push promise contains all the headers that pertain to a server-initiated
request, and a promisedStreamId
to which response frames will be
delivered. Push promise frames are sent as a part of the response to
streamId
. The promisedStreamId
has a priority of one
greater than streamId
.
streamId
- client-initiated stream ID. Must be an odd number.promisedStreamId
- server-initiated stream ID. Must be an even
number.requestHeaders
- minimally includes :method
, :scheme
,
:authority
, and (@code :path}.IOException
void flush() throws IOException
IOException
void synStream(boolean outFinished, boolean inFinished, int streamId, int associatedStreamId, List<Header> headerBlock) throws IOException
IOException
void synReply(boolean outFinished, int streamId, List<Header> headerBlock) throws IOException
IOException
void headers(int streamId, List<Header> headerBlock) throws IOException
IOException
void rstStream(int streamId, ErrorCode errorCode) throws IOException
IOException
int maxDataLength()
data(boolean, int, okio.Buffer, int)
.void data(boolean outFinished, int streamId, okio.Buffer source, int byteCount) throws IOException
source.length
may be longer than the max length of the variant's data frame.
Implementations must send multiple frames as necessary.source
- the buffer to draw bytes from. May be null if byteCount is 0.byteCount
- must be between 0 and the minimum of {code source.length}
and maxDataLength()
.IOException
void settings(Settings okHttpSettings) throws IOException
IOException
void ping(boolean ack, int payload1, int payload2) throws IOException
ack
indicates this is
a reply. Payload parameters are different between SPDY/3 and HTTP/2.
In SPDY/3, only the first payload1
parameter is sent. If the
sender is a client, it is an unsigned odd number. Likewise, a server
will send an even number.
In HTTP/2, both payload1
and payload2
parameters are
sent. The data is opaque binary, and there are no rules on the content.
IOException
void goAway(int lastGoodStreamId, ErrorCode errorCode, byte[] debugData) throws IOException
lastGoodStreamId
, or zero if no streams were processed.lastGoodStreamId
- the last stream ID processed, or zero if no
streams were processed.errorCode
- reason for closing the connection.debugData
- only valid for HTTP/2; opaque debug data to send.IOException
void windowUpdate(int streamId, long windowSizeIncrement) throws IOException
windowSizeIncrement
bytes can be
sent on streamId
, or the connection if streamId
is zero.IOException
Copyright © 2015. All rights reserved.