35 if (stream !=
nullptr) {
60 if (mPriv->stream ==
nullptr) {
61 return mPriv->nullStream;
63 return mPriv->stream->getInputStream();
69 if (mPriv->stream ==
nullptr) {
70 return mPriv->nullStream;
72 return mPriv->stream->getOutputStream();
78 return (mPriv->stream ==
nullptr) ? mPriv->nullStream.getLocalAddress()
79 : (mPriv->stream->getLocalAddress());
85 return (mPriv->stream ==
nullptr) ? mPriv->nullStream.getRemoteAddress()
86 : (mPriv->stream->getRemoteAddress());
97 mPriv->stream = stream;
103 mPriv->stream =
nullptr;
109 return mPriv->stream;
114 return mPriv->stream ==
nullptr;
119 if (mPriv->stream !=
nullptr) {
120 return mPriv->stream->isOk();
127 if (mPriv->stream !=
nullptr) {
128 mPriv->stream->reset();
134 if (mPriv->stream !=
nullptr) {
135 mPriv->stream->beginPacket();
141 if (mPriv->stream !=
nullptr) {
142 mPriv->stream->endPacket();
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
A "null" stream, always invalid.
Simple specification of the minimum functions needed from output streams.
A container for a stream, allowing the stream implementation to be replaced when needed.
void endPacket() override
Mark the end of a logical packet (see beginPacket).
virtual void takeStream(TwoWayStream *stream)
Wrap the supplied stream.
virtual ~ShiftStream()
Destructor.
bool isOk() const override
Check if the stream is ok or in an error state.
virtual TwoWayStream * giveStream()
Removes the wrapped stream and returns it.
InputStream & getInputStream() override
Get an InputStream to read from.
virtual void check() const
Perform maintenance actions, if needed.
virtual TwoWayStream * getStream() const
void reset() override
Reset the stream.
void beginPacket() override
Mark the beginning of a logical packet.
const Contact & getLocalAddress() const override
Get the address of the local side of the stream.
virtual bool isEmpty() const
ShiftStream()
Constructor.
const Contact & getRemoteAddress() const override
Get the address of the remote side of the stream.
void close() override
Terminate the stream.
OutputStream & getOutputStream() override
Get an OutputStream to write to.
A stream which can be asked to perform bidirectional communication.