public final class Http2Connection extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
Http2Connection.Builder |
static class |
Http2Connection.Listener
侦听由对等方发起的流和设置.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
Protocol |
getProtocol() |
boolean |
isShutdown() |
int |
maxConcurrentStreams() |
Http2Stream |
newStream(List<HttpHeaders> requestHeaders,
boolean out) |
int |
openStreamCount() |
Http2Stream |
pushStream(int associatedStreamId,
List<HttpHeaders> requestHeaders,
boolean out)
返回一个新的服务器发起的流.
|
void |
setSettings(Settings settings) |
void |
shutdown(ErrorCode statusCode) |
void |
start() |
void |
writeData(int streamId,
boolean outFinished,
Buffer buffer,
long byteCount)
此方法的调用程序不是线程安全的,有时在应用程序线程上也是如此。
通常,将调用此方法将数据的缓冲区发送给对等方.
|
public Protocol getProtocol()
public int openStreamCount()
public int maxConcurrentStreams()
public Http2Stream pushStream(int associatedStreamId, List<HttpHeaders> requestHeaders, boolean out) throws IOException
associatedStreamId - 触发发送方创建此流的流.requestHeaders - 请求头信息out - 创建一个输出流,我们可以使用它将数据发送到远程对等端。对应FLAG_FINIOException - 异常public Http2Stream newStream(List<HttpHeaders> requestHeaders, boolean out) throws IOException
IOExceptionpublic void writeData(int streamId,
boolean outFinished,
Buffer buffer,
long byteCount)
throws IOException
byteCount之前,
调用者将阻塞。例如,HttpURLConnection的用户向输出流刷新的
字节比连接的写窗口多,就会阻塞streamId - 是否streamIdoutFinished - 是否结束buffer - 缓冲byteCount - 字节流大小IOException - 异常public void flush()
throws IOException
IOExceptionpublic void shutdown(ErrorCode statusCode) throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void start()
throws IOException
IOExceptionpublic void setSettings(Settings settings) throws IOException
IOExceptionpublic boolean isShutdown()
Copyright © 2020. All rights reserved.