W - Type of data that can be written on the associated channel.public class DefaultChannelOperations<W> extends java.lang.Object implements ChannelOperations<W>
ChannelOperations.FLUSH_ON_EACH_BYTES, FLUSH_ON_EACH_FILE_REGION, FLUSH_ON_EACH_STRING, FLUSH_ONLY_ON_READ_COMPLETE| Constructor and Description |
|---|
DefaultChannelOperations(io.netty.channel.Channel nettyChannel,
ConnectionEventListener eventListener,
EventPublisher eventPublisher) |
| Modifier and Type | Method and Description |
|---|---|
rx.Observable<java.lang.Void> |
close()
Flushes any pending writes and closes the connection.
|
rx.Observable<java.lang.Void> |
close(boolean flush)
Closes this channel after flushing all pending writes.
|
rx.Observable<java.lang.Void> |
closeListener()
Returns an
Observable that completes when this connection is closed. |
void |
closeNow()
Closes the connection immediately.
|
void |
flush()
Flushes any pending writes on this connection by calling
Channel.flush(). |
<WW> ChannelOperations<WW> |
transformWrite(AllocatingTransformer<WW,W> transformer)
Modifies the underneath channel to enable writing new type of objects that will be transformed using the passed
transformer |
rx.Observable<java.lang.Void> |
write(rx.Observable<W> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
write(rx.Observable<W> msgs,
rx.functions.Func1<W,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeAndFlushOnEach(rx.Observable<W> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
rx.Observable<java.lang.Void> |
writeBytes(rx.Observable<byte[]> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
writeBytes(rx.Observable<byte[]> msgs,
rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeBytesAndFlushOnEach(rx.Observable<byte[]> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
rx.Observable<java.lang.Void> |
writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs,
rx.functions.Func1<io.netty.channel.FileRegion,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeFileRegionAndFlushOnEach(rx.Observable<io.netty.channel.FileRegion> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
rx.Observable<java.lang.Void> |
writeString(rx.Observable<java.lang.String> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
writeString(rx.Observable<java.lang.String> msgs,
rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeStringAndFlushOnEach(rx.Observable<java.lang.String> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
public DefaultChannelOperations(io.netty.channel.Channel nettyChannel,
ConnectionEventListener eventListener,
EventPublisher eventPublisher)
public rx.Observable<java.lang.Void> write(rx.Observable<W> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
Observablewrite in interface ChannelOperations<W>msgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> write(rx.Observable<W> msgs, rx.functions.Func1<W,java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.write in interface ChannelOperations<W>msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeAndFlushOnEach(rx.Observable<W> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.writeAndFlushOnEach in interface ChannelOperations<W>msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public rx.Observable<java.lang.Void> writeString(rx.Observable<java.lang.String> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
ObservablewriteString in interface ChannelOperations<W>msgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> writeString(rx.Observable<java.lang.String> msgs,
rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.writeString in interface ChannelOperations<W>msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeStringAndFlushOnEach(rx.Observable<java.lang.String> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.writeStringAndFlushOnEach in interface ChannelOperations<W>msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public rx.Observable<java.lang.Void> writeBytes(rx.Observable<byte[]> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
ObservablewriteBytes in interface ChannelOperations<W>msgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> writeBytes(rx.Observable<byte[]> msgs,
rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.writeBytes in interface ChannelOperations<W>msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeBytesAndFlushOnEach(rx.Observable<byte[]> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.writeBytesAndFlushOnEach in interface ChannelOperations<W>msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public rx.Observable<java.lang.Void> writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
ObservablewriteFileRegion in interface ChannelOperations<W>msgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs,
rx.functions.Func1<io.netty.channel.FileRegion,java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.writeFileRegion in interface ChannelOperations<W>msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeFileRegionAndFlushOnEach(rx.Observable<io.netty.channel.FileRegion> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.writeFileRegionAndFlushOnEach in interface ChannelOperations<W>msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public <WW> ChannelOperations<WW> transformWrite(AllocatingTransformer<WW,W> transformer)
ChannelOperationstransformertransformWrite in interface ChannelOperations<W>WW - The target type of the transformer.transformer - Transformer to transform objects written to the channel.ChannelOperations that accepts the transformed type to write.public void flush()
ChannelOperationsChannel.flush(). This can be used for
implementing any custom flusing strategies that otherwise can not be implemented by methods like
ChannelOperations.write(Observable, Func1).flush in interface ChannelOperations<W>public rx.Observable<java.lang.Void> close()
ChannelOperationsclose(true)close in interface ChannelOperations<W>Observable representing the result of close.public rx.Observable<java.lang.Void> close(boolean flush)
ChannelOperationsclose in interface ChannelOperations<W>Observable representing the result of close and flush.public void closeNow()
ChannelOperationsChannelOperations.close() and subscribing to the returned
ObservablecloseNow in interface ChannelOperations<W>public rx.Observable<java.lang.Void> closeListener()
ChannelOperationsObservable that completes when this connection is closed.closeListener in interface ChannelOperations<W>Observable that completes when this connection is closed.