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, visitTickerRemoveSubscriptionpublic 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 MessageVisitorvisitHeartbeat in class AbstractMessageVisitorpublic boolean visitData(DataProvider provider, MessageType message)
AbstractMessageVisitorvisitData in interface MessageVisitorvisitData in class AbstractMessageVisitorfalse 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)
AbstractMessageVisitorvisitSubscription in interface MessageVisitorvisitSubscription in class AbstractMessageVisitorfalse 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)
AbstractMessageVisitortrue.visitOtherMessage in interface MessageVisitorvisitOtherMessage in class AbstractMessageVisitormessageType - 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 Closeableclose in interface AutoCloseableIOExceptionpublic void flush()
throws IOException
flush in interface FlushableIOExceptionpublic void messagesAvailable(MessageProvider provider)
MessageListenermessagesAvailable in interface MessageListenerCopyright © 2002–2025 Devexperts LLC. All rights reserved.