public class OutputStreamComposer extends BinaryQTPComposer
OutputStream in binary QTP format.
It serves as a convenience object that combines output buffer and composer together.
It can be used as MessageVisitor, DataVisitor, SubscriptionVisitor or RecordSink to
store snapshots of data to a file, which can be later read with InputStreamParser.
For more advanced file writing capabilities (to write event tapes) see com.devexperts.qd.qtp.file package.InputStreamParsercurrentMessageType, msg, optSet, scheme, stats, writeEventTimeSequence, writeHeartbeatVOID| Constructor and Description |
|---|
OutputStreamComposer(DataScheme scheme)
Creates composer for specified data scheme.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(RecordCursor cursor)
Adds a record to this sink from the specified
RecordCursor. |
void |
composeCollector(QDCollector collector)
Composes specified collector.
|
void |
composeEndpoint(QDEndpoint endpoint)
Composes all collectors defined in specified endpoint.
|
void |
flush()
Finishes current message if any and sends all composed bytes to output stream.
|
void |
flushMessage()
Finishes current message.
|
int |
getRecordCounter()
Returns number of composed records since initialization.
|
boolean |
hasCapacity()
Returns
true when this message's capacity had not exceeded threshold yet. |
void |
init(OutputStream output,
SubscriptionFilter filter)
Initializes composer with a specified output stream and subscription filter parameters.
|
void |
setMessageType(MessageType messageType)
Sets message type for subsequent data or subscription.
|
void |
setOutput(com.devexperts.io.BufferedOutput output)
Changes output for the composed messages.
|
boolean |
visitData(DataProvider provider,
MessageType type)
This method consumes available data for data message from the given data provider.
|
void |
visitIntField(DataIntField field,
int value)
Visits next Int-field within current record.
|
void |
visitObjField(DataObjField field,
Object value)
Visits next Obj-field within current record.
|
boolean |
visitOtherMessage(int messageType,
byte[] messageBytes,
int offset,
int length)
This method consumes other message type.
|
void |
visitRecord(DataRecord record,
int cipher,
String symbol)
Visits next record.
|
void |
visitRecord(DataRecord record,
int cipher,
String symbol,
long time)
Visits next record.
|
boolean |
visitSubscription(SubscriptionProvider provider,
MessageType type)
This method consumes available subscription for subscription message from the given subscription provider.
|
describeRecord, finishComposingMessage, getRequestedRecordDesc, isWideDecimalSupported, writeDescribeProtocolMessage, writeEmptyHeartbeatMessage, writeEventTimeSequence, writeField, writeHeartbeatMessage, writeHistorySubscriptionTime, writeIntField, writeMessageHeader, writeObjField, writeOtherMessageBody, writeRecordHeader, writeRecordPayloadabortMessageAndRethrow, beginMessage, beginRecord, compose, composeDescribeProtocol, composeEmptyHeartbeat, composeHeartbeatMessage, composeTimeProgressReport, endMessage, getEventTimeSequence, getMessagePayloadSize, inMessage, resetSession, setOptSet, setStats, setWriteEventTimeSequence, setWriteHeartbeat, undoWriteMessageHeaderStateChange, visitDescribeProtocol, visitHeartbeatvisitHistoryAddSubscription, visitHistoryData, visitHistoryRemoveSubscription, visitStreamAddSubscription, visitStreamData, visitStreamRemoveSubscription, visitTickerAddSubscription, visitTickerData, visitTickerRemoveSubscriptionpublic OutputStreamComposer(DataScheme scheme)
init this composer before using it.public void setOutput(com.devexperts.io.BufferedOutput output)
UnsupportedOperationException.setOutput in class AbstractQTPComposeroutput - output for the composed messages.public void init(OutputStream output, SubscriptionFilter filter)
public void composeEndpoint(QDEndpoint endpoint)
public void composeCollector(QDCollector collector)
public void setMessageType(MessageType messageType)
public int getRecordCounter()
public void flush()
flush in interface RecordSinkflush in class AbstractQTPComposerpublic void flushMessage()
public boolean visitData(DataProvider provider, MessageType type)
AbstractQTPComposervisitData in interface MessageVisitorvisitData in class AbstractQTPComposerfalse 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 type)
AbstractQTPComposervisitSubscription in interface MessageVisitorvisitSubscription in class AbstractQTPComposerfalse 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)
AbstractQTPComposervisitOtherMessage in interface MessageVisitorvisitOtherMessage in class AbstractQTPComposermessageType - 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 boolean hasCapacity()
AbstractQTPComposertrue when this message's capacity had not exceeded threshold yet.
This implementation always returns true when invoked not in message,
e.g. the overall number of bytes composed is not checked by this implementation
(only the message size for data and subscription messages is limited).
Each call to AbstractQTPComposer.beginMessage(MessageType) resets capacity threshold for a new message.hasCapacity in interface DataVisitorhasCapacity in interface RecordSinkhasCapacity in interface SubscriptionVisitorhasCapacity in class AbstractQTPComposerpublic void append(RecordCursor cursor)
RecordSinkRecordCursor.append in interface RecordSinkappend in class AbstractQTPComposerpublic void visitRecord(DataRecord record, int cipher, String symbol, long time)
SubscriptionVisitorvisitRecord in interface RecordSinkvisitRecord in interface SubscriptionVisitorvisitRecord in class AbstractQTPComposerpublic void visitRecord(DataRecord record, int cipher, String symbol)
DataVisitorvisitRecord in interface DataVisitorvisitRecord in interface RecordSinkvisitRecord in class AbstractQTPComposerpublic void visitIntField(DataIntField field, int value)
DataVisitorvisitIntField in interface DataVisitorvisitIntField in interface RecordSinkvisitIntField in class AbstractQTPComposerpublic void visitObjField(DataObjField field, Object value)
DataVisitorvisitObjField in interface DataVisitorvisitObjField in interface RecordSinkvisitObjField in class AbstractQTPComposerCopyright © 2002–2025 Devexperts LLC. All rights reserved.