public class SpdyStream extends Object implements AttributeStorage, OutputSink, Closeable
Modifier and Type | Class and Description |
---|---|
protected static class |
SpdyStream.Termination |
protected static class |
SpdyStream.TerminationType |
Modifier and Type | Field and Description |
---|---|
static String |
SPDY_STREAM_ATTRIBUTE |
Modifier | Constructor and Description |
---|---|
protected |
SpdyStream(SpdySession spdySession,
HttpRequestPacket spdyRequest,
int streamId,
int associatedToStreamId,
int priority,
int slot,
boolean isUnidirectional) |
Modifier and Type | Method and Description |
---|---|
void |
addCloseListener(CloseListener closeListener)
Add the
CloseListener , which will be notified once the stream
will be closed. |
PushResource |
addPushResource(String url,
PushResource pushResource) |
void |
assertOpen()
Checks if this Closeable is open and ready to be used.
|
boolean |
canWrite() |
boolean |
canWrite(int length)
Deprecated.
|
GrizzlyFuture<Closeable> |
close()
Gracefully (if supported by the implementation) closes this stream and
releases any system resources associated with it.
|
void |
close(CompletionHandler<Closeable> completionHandler)
Deprecated.
please use
close() with the following GrizzlyFuture.addCompletionHandler(org.glassfish.grizzly.CompletionHandler) call |
void |
closeSilently()
Gracefully (if supported by the implementation) closes this stream and
releases any system resources associated with it.
|
void |
closeWithReason(IOException cause)
Gracefully closes the Closeable and provides the reason description.
|
int |
getAssociatedToStreamId() |
AttributeHolder |
getAttributes()
Get associated
AttributeHolder . |
int |
getLocalWindowSize() |
int |
getPeerWindowSize() |
int |
getPriority() |
int |
getSlot() |
HttpRequestPacket |
getSpdyRequest() |
HttpResponsePacket |
getSpdyResponse() |
static SpdyStream |
getSpdyStream(HttpHeader httpHeader) |
int |
getStreamId() |
int |
getUnflushedWritesCount() |
boolean |
isLocallyInitiatedStream() |
boolean |
isOpen()
Is Closeable open and ready.
|
boolean |
isUnidirectional() |
void |
notifyCanWrite(WriteHandler writeHandler)
Instructs the
OutputSink to invoke the provided
WriteHandler when it is possible to write more bytes (or characters). |
void |
notifyCanWrite(WriteHandler handler,
int length)
Deprecated.
|
boolean |
removeCloseListener(CloseListener closeListener)
Remove the
CloseListener . |
PushResource |
removePushResource(String url) |
GrizzlyFuture<Closeable> |
terminate()
Closes this stream and releases any system resources associated with it.
|
void |
terminateSilently()
Closes this stream and releases any system resources associated with it.
|
void |
terminateWithReason(IOException cause)
Closes the Closeable and provides the reason description.
|
public static final String SPDY_STREAM_ATTRIBUTE
protected SpdyStream(SpdySession spdySession, HttpRequestPacket spdyRequest, int streamId, int associatedToStreamId, int priority, int slot, boolean isUnidirectional)
public static SpdyStream getSpdyStream(HttpHeader httpHeader)
public int getPeerWindowSize()
public int getLocalWindowSize()
public int getUnflushedWritesCount()
public HttpRequestPacket getSpdyRequest()
public HttpResponsePacket getSpdyResponse()
public PushResource addPushResource(String url, PushResource pushResource)
public PushResource removePushResource(String url)
public int getStreamId()
public int getAssociatedToStreamId()
public int getPriority()
public int getSlot()
public boolean isUnidirectional()
public boolean isLocallyInitiatedStream()
public boolean isOpen()
Closeable
public void assertOpen() throws IOException
Closeable
IOException
giving the reason why this Closeable
was closed.assertOpen
in interface Closeable
IOException
public AttributeHolder getAttributes()
AttributeStorage
AttributeHolder
.
Implementation may return null if AttributeHolder
wasn't
initialized yet.getAttributes
in interface AttributeStorage
AttributeHolder
.
Implementation may return null if AttributeHolder
wasn't
initialized yet.@Deprecated public boolean canWrite(int length)
canWrite
in interface OutputSink
length
- specifies the number of bytes (or characters) that require writingtrue
if a write to this OutputSink
will succeed, otherwise returns false
.public boolean canWrite()
canWrite
in interface OutputSink
true
if a write to this OutputSink
will succeed, otherwise returns false
.@Deprecated public void notifyCanWrite(WriteHandler handler, int length)
OutputSink
OutputSink
to invoke the provided
WriteHandler
when it is possible to write length
bytes (or characters).
Note that once the WriteHandler
has been notified, it will not
be considered for notification again at a later point in time.notifyCanWrite
in interface OutputSink
handler
- the WriteHandler
that should be notified
when it's possible to write length
bytes.length
- the number of bytes or characters that require writing.public void notifyCanWrite(WriteHandler writeHandler)
OutputSink
OutputSink
to invoke the provided
WriteHandler
when it is possible to write more bytes (or characters).
Note that once the WriteHandler
has been notified, it will not
be considered for notification again at a later point in time.notifyCanWrite
in interface OutputSink
writeHandler
- the WriteHandler
that should be notified
when it's possible to write more data.public GrizzlyFuture<Closeable> terminate()
Closeable
public void terminateSilently()
Closeable
terminateSilently
in interface Closeable
public void terminateWithReason(IOException cause)
Closeable
Closeable.terminateSilently()
, but additionally
provides the reason why the Closeable will be closed.terminateWithReason
in interface Closeable
public GrizzlyFuture<Closeable> close()
Closeable
public void closeSilently()
Closeable
closeSilently
in interface Closeable
public void close(CompletionHandler<Closeable> completionHandler)
close()
with the following GrizzlyFuture.addCompletionHandler(org.glassfish.grizzly.CompletionHandler)
callclose
in interface Closeable
completionHandler
- CompletionHandler
to be called, when
the stream is closedpublic void closeWithReason(IOException cause)
Closeable
Closeable.closeSilently()
, but additionally
provides the reason why the Closeable will be closed.closeWithReason
in interface Closeable
public void addCloseListener(CloseListener closeListener)
Closeable
CloseListener
, which will be notified once the stream
will be closed.addCloseListener
in interface Closeable
closeListener
- CloseListener
.public boolean removeCloseListener(CloseListener closeListener)
Closeable
CloseListener
.removeCloseListener
in interface Closeable
closeListener
- CloseListener
.Copyright © 2015 Oracle Corporation. All rights reserved.