- All Known Subinterfaces:
Connection<L>
,Writeable<L>
- All Known Implementing Classes:
NIOConnection
,TCPNIOConnection
,TCPNIOServerConnection
,UDPNIOConnection
,UDPNIOServerConnection
public interface OutputSink
This interface defines methods to allow an OutputStream
or Writer
to allow the
developer to check with the runtime whether or not it's possible to write a certain amount of data, or if it's not
possible, to be notified when it is.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canWrite()
boolean
canWrite
(int length) Deprecated.void
notifyCanWrite
(WriteHandler handler) Instructs theOutputSink
to invoke the providedWriteHandler
when it is possible to write more bytes (or characters).void
notifyCanWrite
(WriteHandler handler, int length) Deprecated.thelength
parameter will be ignored.
-
Method Details
-
notifyCanWrite
Instructs theOutputSink
to invoke the providedWriteHandler
when it is possible to write more bytes (or characters). Note that once theWriteHandler
has been notified, it will not be considered for notification again at a later point in time.- Parameters:
handler
- theWriteHandler
that should be notified when it's possible to write more data.- Throws:
IllegalStateException
- if this method is invoked and a handler from a previous invocation is still present (due to not having yet been notified).- Since:
- 2.3
-
notifyCanWrite
Deprecated.thelength
parameter will be ignored. Pls. usenotifyCanWrite(org.glassfish.grizzly.WriteHandler)
.Instructs theOutputSink
to invoke the providedWriteHandler
when it is possible to writelength
bytes (or characters). Note that once theWriteHandler
has been notified, it will not be considered for notification again at a later point in time.- Parameters:
handler
- theWriteHandler
that should be notified when it's possible to writelength
bytes.length
- the number of bytes or characters that require writing.- Throws:
IllegalStateException
- if this method is invoked and a handler from a previous invocation is still present (due to not having yet been notified).
-
canWrite
boolean canWrite()- Returns:
true
if a write to thisOutputSink
will succeed, otherwise returnsfalse
.- Since:
- 2.3
-
canWrite
Deprecated.thelength
parameter will be ignored. Pls. usecanWrite()
.- Parameters:
length
- specifies the number of bytes (or characters) that require writing- Returns:
true
if a write to thisOutputSink
will succeed, otherwise returnsfalse
.
-
length
parameter will be ignored.