Constructor and Description |
---|
StandardStream(SynStreamFrame frame,
ISession session,
int windowSize) |
Modifier and Type | Method and Description |
---|---|
Future<Void> |
data(DataInfo dataInfo)
Sends asynchronously a DATA frame on this stream.
|
void |
data(DataInfo dataInfo,
long timeout,
TimeUnit unit,
Handler<Void> handler)
Sends asynchronously a DATA frame on this stream.
|
Object |
getAttribute(String key) |
int |
getId() |
byte |
getPriority() |
Session |
getSession() |
int |
getWindowSize()
Senders of data frames need to know the current window size
to determine whether they can send more data.
|
Future<Void> |
headers(HeadersInfo headersInfo)
Sends asynchronously a HEADER frame on this stream.
|
void |
headers(HeadersInfo headersInfo,
long timeout,
TimeUnit unit,
Handler<Void> handler)
Sends asynchronously a HEADER frame on this stream.
|
boolean |
isClosed() |
boolean |
isHalfClosed() |
void |
process(ControlFrame frame)
Processes the given control frame,
for example by updating the stream's state or by calling listeners.
|
void |
process(DataFrame frame,
ByteBuffer data)
Processes the give data frame along with the given byte buffer,
for example by updating the stream's state or by calling listeners.
|
Object |
removeAttribute(String key) |
Future<Void> |
reply(ReplyInfo replyInfo)
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
|
void |
reply(ReplyInfo replyInfo,
long timeout,
TimeUnit unit,
Handler<Void> handler)
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
|
void |
setAttribute(String key,
Object value) |
void |
setStreamFrameListener(StreamFrameListener listener) |
String |
toString() |
void |
updateCloseState(boolean close,
boolean local)
A stream can be open,
half closed or
closed and this method updates the close state
of this stream. |
void |
updateWindowSize(int delta)
Updates the window size for this stream by the given amount,
that can be positive or negative.
|
public StandardStream(SynStreamFrame frame, ISession session, int windowSize)
public byte getPriority()
getPriority
in interface Stream
public int getWindowSize()
IStream
Senders of data frames need to know the current window size to determine whether they can send more data.
getWindowSize
in interface IStream
IStream.updateWindowSize(int)
public void updateWindowSize(int delta)
IStream
Updates the window size for this stream by the given amount, that can be positive or negative.
Senders and recipients of data frames update the window size, respectively, with negative values and positive values.
updateWindowSize
in interface IStream
delta
- the signed amount the window size needs to be updatedIStream.getWindowSize()
public Session getSession()
getSession
in interface Stream
public boolean isHalfClosed()
isHalfClosed
in interface Stream
* @param timeout the timeout for the stream creation
public Object getAttribute(String key)
getAttribute
in interface Stream
key
- the attribute keyStream.setAttribute(String, Object)
public void setAttribute(String key, Object value)
setAttribute
in interface Stream
key
- the attribute keyvalue
- an arbitrary object to associate with the given key to this streamStream.getAttribute(String)
,
Stream.removeAttribute(String)
public Object removeAttribute(String key)
removeAttribute
in interface Stream
key
- the attribute keyStream.setAttribute(String, Object)
public void setStreamFrameListener(StreamFrameListener listener)
setStreamFrameListener
in interface IStream
listener
- the stream frame listener associated to this stream
as returned by SessionFrameListener.onSyn(Stream, SynInfo)
public void updateCloseState(boolean close, boolean local)
IStream
A stream can be open, half closed
or
closed
and this method updates the close state
of this stream.
If the stream is open, calling this method with a value of true puts the stream into half closed state.
If the stream is half closed, calling this method with a value of true puts the stream into closed state.
updateCloseState
in interface IStream
close
- whether the close state should be updatedlocal
- whether the close is local or remotepublic void process(ControlFrame frame)
IStream
Processes the given control frame, for example by updating the stream's state or by calling listeners.
process
in interface IStream
frame
- the control frame to processIStream.process(DataFrame, ByteBuffer)
public void process(DataFrame frame, ByteBuffer data)
IStream
Processes the give data frame along with the given byte buffer, for example by updating the stream's state or by calling listeners.
process
in interface IStream
frame
- the data frame to processdata
- the byte buffer to processIStream.process(ControlFrame)
public Future<Void> reply(ReplyInfo replyInfo)
Stream
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
Callers may use the returned future to wait for the reply to be actually sent.
reply
in interface Stream
replyInfo
- the metadata to sendStream.reply(ReplyInfo, long, TimeUnit, Handler)
,
SessionFrameListener.onSyn(Stream, SynInfo)
public void reply(ReplyInfo replyInfo, long timeout, TimeUnit unit, Handler<Void> handler)
Stream
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
Callers may pass a non-null completion handler to be notified of when the reply has been actually sent.
reply
in interface Stream
replyInfo
- the metadata to sendtimeout
- the operation's timeoutunit
- the timeout's unithandler
- the completion handler that gets notified of reply sentStream.reply(ReplyInfo)
public Future<Void> data(DataInfo dataInfo)
Stream
Sends asynchronously a DATA frame on this stream.
DATA frames should always be sent after a SYN_REPLY frame.
Callers may use the returned future to wait for the data to be actually sent.
data
in interface Stream
dataInfo
- the metadata to sendStream.data(DataInfo, long, TimeUnit, Handler)
,
Stream.reply(ReplyInfo)
public void data(DataInfo dataInfo, long timeout, TimeUnit unit, Handler<Void> handler)
Stream
Sends asynchronously a DATA frame on this stream.
DATA frames should always be sent after a SYN_REPLY frame.
Callers may pass a non-null completion handler to be notified of when the data has been actually sent.
data
in interface Stream
dataInfo
- the metadata to sendtimeout
- the operation's timeoutunit
- the timeout's unithandler
- the completion handler that gets notified of data sentStream.data(DataInfo)
public Future<Void> headers(HeadersInfo headersInfo)
Stream
Sends asynchronously a HEADER frame on this stream.
HEADERS frames should always be sent after a SYN_REPLY frame.
Callers may use the returned future to wait for the headers to be actually sent.
headers
in interface Stream
headersInfo
- the metadata to sendStream.headers(HeadersInfo, long, TimeUnit, Handler)
,
Stream.reply(ReplyInfo)
public void headers(HeadersInfo headersInfo, long timeout, TimeUnit unit, Handler<Void> handler)
Stream
Sends asynchronously a HEADER frame on this stream.
HEADERS frames should always be sent after a SYN_REPLY frame.
Callers may pass a non-null completion handler to be notified of when the headers have been actually sent.
headers
in interface Stream
headersInfo
- the metadata to sendtimeout
- the operation's timeoutunit
- the timeout's unithandler
- the completion handler that gets notified of headers sentStream.headers(HeadersInfo)
public boolean isClosed()
isClosed
in interface Stream
Stream.isHalfClosed()
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.