public abstract class AbstractQTPParser extends Object
setInput(BufferedInput)
method
immediately after construction.
Note, that all methods declared to throw IOException
actually never do so if the underlying
BufferedInput
is memory-only. They are declared to throw IOException
only in order not to process it in every subclass but to process it in the outermost methods only,
where they are wrapped in RuntimeQTPException
if they happen.
This class is not thread-safe.
It can be reused to parse unrelated messages if they do not contain record descriptions or if
resetSession()
is called to clean up its state.
AbstractQTPComposer
Modifier and Type | Field and Description |
---|---|
protected long |
eventTimeSequence
Time and sequence which should be set to cursor.
|
protected FieldReplacersCache |
fieldReplacers
Cache of instantiated field replacers.
|
protected boolean |
mixedSubscription
Flag to combine add/remove subscription into a single addSubscription message.
|
protected boolean |
readEventTimeSequence
Flag to read virtual EventTime/EventSequence fields from messages into
RecordMode.TIMESTAMPED_DATA buffer. |
protected DataScheme |
scheme |
protected QDStats |
stats
Where to collect stats to.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractQTPParser(DataScheme scheme)
Constructs parser with a specified scheme.
|
Modifier and Type | Method and Description |
---|---|
protected ProtocolDescriptor |
applyReadAs(ProtocolDescriptor protocolDescriptor) |
protected RecordMode |
getRecordBufferMode(MessageType messageType) |
protected RecordBuffer |
nextRecordsMessage(MessageConsumer consumer,
MessageType messageType) |
void |
parse(MessageConsumer consumer)
Parses accumulated bytes and submits parsed messages to the specified MessageConsumer.
|
protected abstract void |
parseImpl(com.devexperts.io.BufferedInput in,
MessageConsumer consumer) |
protected void |
processPending(MessageConsumer consumer)
Processes pending message from buffers (if any) and resets them to
null . |
void |
readAs(MessageType readAs)
Overrides message type for all data and subscription messages read by this parser.
|
protected void |
replaceFieldIfNeeded(RecordCursor cursor) |
void |
resetSession() |
void |
setEventTimeSequence(long eventTimeSequence) |
protected void |
setEventTimeSequenceIfNeeded(RecordCursor cur) |
void |
setFieldReplacers(FieldReplacersCache fieldReplacers) |
void |
setInput(com.devexperts.io.BufferedInput input)
Changes input to parse messages from.
|
void |
setMixedSubscription(boolean mixedSubscription) |
void |
setReadEventTimeSequence(boolean readEventTimeSequence) |
void |
setStats(QDStats stats)
Changes stats to gather parser statistics.
|
protected final DataScheme scheme
protected QDStats stats
parse(MessageConsumer)
.protected boolean readEventTimeSequence
RecordMode.TIMESTAMPED_DATA
buffer.protected boolean mixedSubscription
protected long eventTimeSequence
protected FieldReplacersCache fieldReplacers
protected AbstractQTPParser(DataScheme scheme)
setInput
before using this parser.scheme
- data scheme.public void setInput(com.devexperts.io.BufferedInput input)
input
- input to parse messages from.public void setStats(QDStats stats)
stats
- stats to gather parser statistics.public void readAs(MessageType readAs)
readAs
- the message type that will be reported for all data and subscription messages,
use null
to turn off override.public void setReadEventTimeSequence(boolean readEventTimeSequence)
public void setMixedSubscription(boolean mixedSubscription)
public void setEventTimeSequence(long eventTimeSequence)
public void setFieldReplacers(FieldReplacersCache fieldReplacers)
public void resetSession()
public final void parse(MessageConsumer consumer)
stats
.
This is the main method in this class.consumer
- MessageConsumer to pass parsed messages.protected abstract void parseImpl(com.devexperts.io.BufferedInput in, MessageConsumer consumer) throws IOException
IOException
protected void processPending(MessageConsumer consumer)
null
.protected RecordBuffer nextRecordsMessage(MessageConsumer consumer, MessageType messageType)
protected RecordMode getRecordBufferMode(MessageType messageType)
protected ProtocolDescriptor applyReadAs(ProtocolDescriptor protocolDescriptor)
protected final void setEventTimeSequenceIfNeeded(RecordCursor cur)
protected void replaceFieldIfNeeded(RecordCursor cursor)
Copyright © 2002–2025 Devexperts LLC. All rights reserved.