Package deltix.qsrv.hf.stream
Class MessageReader2
- java.lang.Object
-
- deltix.qsrv.hf.stream.AbstractMessageReader
-
- deltix.qsrv.hf.stream.MessageReader2
-
- All Implemented Interfaces:
deltix.data.stream.ConsumableMessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
,deltix.data.stream.MessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
,EntitySubscriptionController
,TypedMessageSource
,TypeSubscriptionController
,deltix.util.concurrent.AbstractCursor
,deltix.util.lang.Disposable
,java.io.Closeable
,java.lang.AutoCloseable
public class MessageReader2 extends AbstractMessageReader implements deltix.data.stream.ConsumableMessageSource<deltix.qsrv.hf.pub.InstrumentMessage>, TypeSubscriptionController, EntitySubscriptionController
-
-
Field Summary
Fields Modifier and Type Field Description protected deltix.qsrv.hf.pub.InstrumentKey
currentEntity
protected deltix.util.time.Interval
periodicity
-
Fields inherited from class deltix.qsrv.hf.stream.AbstractMessageReader
buffer, bytes, curMsg, curTypeCode, decoders, ITYPE_TYPES, messages, rawMsg, symbol, types
-
-
Constructor Summary
Constructors Modifier Constructor Description MessageReader2(java.io.InputStream in, long inLength, boolean unzip, int bufferSize, TypeLoader bindLoader)
protected
MessageReader2(java.io.InputStream in, long inLength, boolean unzip, int bufferSize, TypeLoader bindLoader, RecordClassDescriptor[] types)
protected
MessageReader2(java.io.InputStream input, long inLength, RecordClassDescriptor[] types)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Bulk add the specified entities to subscription.void
addEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Add the specified entity to subscription.void
addTypes(java.lang.String... names)
Add the specified type names to subscription.void
clearAllEntities()
Switch to selective subscription mode (if necessary) and clear the list.void
close()
static MessageReader2
create(java.io.File f, int bufferSize, TypeLoader loader)
static MessageReader2
create(java.io.File f, RecordClassDescriptor[] types)
static MessageReader2
create(java.io.File f, TypeLoader loader)
static MessageReader2
createRaw(java.io.File f)
double
getProgress()
boolean
isAtEnd()
static void
main(java.lang.String[] args)
boolean
next()
protected RecordClassDescriptor[]
readHeader()
static byte
readVersion(java.io.File f)
void
removeEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Remove the specified entities from subscription.void
removeEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Remove the specified entity from subscription.void
removeTypes(java.lang.String... names)
Remove the specified types from subscription.void
setTypes(java.lang.String... names)
Subscribe to specified types.void
subscribeToAllEntities()
Subscribe to all available entities.void
subscribeToAllTypes()
Subscribe to all available types (no filtering).-
Methods inherited from class deltix.qsrv.hf.stream.AbstractMessageReader
checkBuffer, decode, getCurrentType, getCurrentTypeIndex, getMessage, getTypes, readHeader, readHeaderWithoutVersion, readVersion
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface deltix.qsrv.hf.tickdb.pub.query.EntitySubscriptionController
addEntities, removeEntities
-
-
-
-
Constructor Detail
-
MessageReader2
public MessageReader2(java.io.InputStream in, long inLength, boolean unzip, int bufferSize, TypeLoader bindLoader) throws java.io.IOException
- Throws:
java.io.IOException
-
MessageReader2
protected MessageReader2(java.io.InputStream in, long inLength, boolean unzip, int bufferSize, TypeLoader bindLoader, RecordClassDescriptor[] types) throws java.io.IOException
- Throws:
java.io.IOException
-
MessageReader2
protected MessageReader2(java.io.InputStream input, long inLength, RecordClassDescriptor[] types) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
createRaw
public static MessageReader2 createRaw(java.io.File f) throws java.io.IOException
- Throws:
java.io.IOException
-
create
public static MessageReader2 create(java.io.File f, TypeLoader loader) throws java.io.IOException
- Throws:
java.io.IOException
-
create
public static MessageReader2 create(java.io.File f, int bufferSize, TypeLoader loader) throws java.io.IOException
- Throws:
java.io.IOException
-
create
public static MessageReader2 create(java.io.File f, RecordClassDescriptor[] types) throws java.io.IOException
- Throws:
java.io.IOException
-
readVersion
public static byte readVersion(java.io.File f) throws java.io.IOException
- Throws:
java.io.IOException
-
readHeader
protected RecordClassDescriptor[] readHeader() throws java.io.IOException
- Throws:
java.io.IOException
-
isAtEnd
public boolean isAtEnd()
- Specified by:
isAtEnd
in interfacedeltix.util.concurrent.AbstractCursor
-
next
public boolean next()
- Specified by:
next
in interfacedeltix.util.concurrent.AbstractCursor
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacedeltix.util.lang.Disposable
-
getProgress
public double getProgress()
- Specified by:
getProgress
in interfacedeltix.data.stream.ConsumableMessageSource<deltix.qsrv.hf.pub.InstrumentMessage>
-
subscribeToAllTypes
public void subscribeToAllTypes()
Description copied from interface:TypeSubscriptionController
Subscribe to all available types (no filtering).- Specified by:
subscribeToAllTypes
in interfaceTypeSubscriptionController
-
addTypes
public void addTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionController
Add the specified type names to subscription.- Specified by:
addTypes
in interfaceTypeSubscriptionController
-
setTypes
public void setTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionController
Subscribe to specified types.- Specified by:
setTypes
in interfaceTypeSubscriptionController
-
removeTypes
public void removeTypes(java.lang.String... names)
Description copied from interface:TypeSubscriptionController
Remove the specified types from subscription.- Specified by:
removeTypes
in interfaceTypeSubscriptionController
-
subscribeToAllEntities
public void subscribeToAllEntities()
Description copied from interface:EntitySubscriptionController
Subscribe to all available entities.- Specified by:
subscribeToAllEntities
in interfaceEntitySubscriptionController
-
clearAllEntities
public void clearAllEntities()
Description copied from interface:EntitySubscriptionController
Switch to selective subscription mode (if necessary) and clear the list.- Specified by:
clearAllEntities
in interfaceEntitySubscriptionController
-
addEntity
public void addEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Description copied from interface:EntitySubscriptionController
Add the specified entity to subscription. The type and symbol are copied from the incoming object, if necessary, so the argument can be re-used after the call. Special note about options: The following fragment will subscribe to specific option contract "DAV 100417P00085000":addEntity(new InstrumentKey(InstrumentType.OPTION, "DAV 100417P00085000"));
While the following will subscribe to option root (and you will get all instruments with this root):addEntity(new InstrumentKey(InstrumentType.OPTION, "DAV "));
- Specified by:
addEntity
in interfaceEntitySubscriptionController
-
addEntities
public void addEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Description copied from interface:EntitySubscriptionController
Bulk add the specified entities to subscription. The type and symbol are copied from the incoming objects, if necessary, so the arguments can be re-used after the call.- Specified by:
addEntities
in interfaceEntitySubscriptionController
-
removeEntity
public void removeEntity(deltix.qsrv.hf.pub.InstrumentIdentity id)
Description copied from interface:EntitySubscriptionController
Remove the specified entity from subscription. The type and symbol are copied from the incoming object, if necessary, so the argument can be re-used after the call.- Specified by:
removeEntity
in interfaceEntitySubscriptionController
-
removeEntities
public void removeEntities(deltix.qsrv.hf.pub.InstrumentIdentity[] ids, int offset, int length)
Description copied from interface:EntitySubscriptionController
Remove the specified entities from subscription. The type and symbol are copied from the incoming objects, if necessary, so the arguments can be re-used after the call.- Specified by:
removeEntities
in interfaceEntitySubscriptionController
-
main
public static void main(java.lang.String[] args) throws java.io.IOException
- Throws:
java.io.IOException
-
-