public class OutputStreamMessageVisitor extends AbstractMessageVisitor implements MessageListener, Closeable, Flushable
OutputStream
using a specified QTP composer.
It typically used to format text onto the console. This class is thread-safe.
It contains its own synchronization and can be used by multiple threads.Constructor and Description |
---|
OutputStreamMessageVisitor(OutputStream out,
AbstractQTPComposer composer,
boolean autoFlush)
Creates output stream message visitor writing to a specified output stream with a specified composer.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
messagesAvailable(MessageProvider provider)
Notifies this listener that some messages are available in the
specified QTP message provider.
|
boolean |
visitData(DataProvider provider,
MessageType message)
This method consumes available data for data message from the given data provider.
|
void |
visitHeartbeat(HeartbeatPayload heartbeatPayload) |
boolean |
visitOtherMessage(int messageType,
byte[] messageBytes,
int offset,
int length)
This method consumes other message type.
|
boolean |
visitSubscription(SubscriptionProvider provider,
MessageType message)
This method consumes available subscription for subscription message from the given subscription provider.
|
visitDescribeProtocol, visitHistoryAddSubscription, visitHistoryData, visitHistoryRemoveSubscription, visitStreamAddSubscription, visitStreamData, visitStreamRemoveSubscription, visitTickerAddSubscription, visitTickerData, visitTickerRemoveSubscription
public OutputStreamMessageVisitor(OutputStream out, AbstractQTPComposer composer, boolean autoFlush)
out
- the output stream.composer
- the composer.autoFlush
- if true
, then flushes composed bytes to an underlying output stream after each packet.public void visitHeartbeat(HeartbeatPayload heartbeatPayload)
visitHeartbeat
in interface MessageVisitor
visitHeartbeat
in class AbstractMessageVisitor
public boolean visitData(DataProvider provider, MessageType message)
AbstractMessageVisitor
visitData
in interface MessageVisitor
visitData
in class AbstractMessageVisitor
false
if it had retrieved all available data and no data left,
true
if more data remains to be consumed.public boolean visitSubscription(SubscriptionProvider provider, MessageType message)
AbstractMessageVisitor
visitSubscription
in interface MessageVisitor
visitSubscription
in class AbstractMessageVisitor
false
if it had retrieved all available subscription and nothing left,
true
if more subscription remains to be consumed.public boolean visitOtherMessage(int messageType, byte[] messageBytes, int offset, int length)
AbstractMessageVisitor
true
.visitOtherMessage
in interface MessageVisitor
visitOtherMessage
in class AbstractMessageVisitor
messageType
- integer number representing a type of the message.messageBytes
- array containing message data.offset
- position of the first byte of message data in messageBytes
array.length
- number of bytes starting from offset
in messageBytes
related to this message.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void flush() throws IOException
flush
in interface Flushable
IOException
public void messagesAvailable(MessageProvider provider)
MessageListener
messagesAvailable
in interface MessageListener
Copyright © 2002–2025 Devexperts LLC. All rights reserved.