public class MqttPacketOutputStream extends ByteArrayOutputStream
OutputStream
for MQTT packet with a flush method that
sends the packet.buf, count
Constructor and Description |
---|
MqttPacketOutputStream(String topic,
IMqttAsyncClient mqttClient,
int qos,
boolean retained) |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flushes this output stream and forces any buffered output bytes to be written out.
|
close, reset, size, toByteArray, toString, write, write, writeTo
write
public MqttPacketOutputStream(String topic, IMqttAsyncClient mqttClient, int qos, boolean retained)
topic
- MQTT TopicmqttClient
- MQTT Clientqos
- MQTT QOSretained
- MQTT retained flagpublic void flush() throws IOException
OutputStream
flush
is that calling it is an indication that, if any bytes previously
written have been buffered by the implementation of the output stream, such bytes should
immediately be written to their intended destination.
If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
The flush
method of OutputStream
does nothing.
flush
in interface Flushable
flush
in class OutputStream
IOException
- if an I/O error occurs.