Java Code Examples for net.openhft.chronicle.bytes.BytesIn#readInt()

The following examples show how to use net.openhft.chronicle.bytes.BytesIn#readInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrderBookDirectImpl.java    From exchange-core with Apache License 2.0 6 votes vote down vote up
public OrderBookDirectImpl(final BytesIn bytes,
                           final ObjectsPool objectsPool,
                           final OrderBookEventsHelper eventsHelper,
                           final LoggingConfiguration loggingCfg) {

    this.symbolSpec = new CoreSymbolSpecification(bytes);
    this.objectsPool = objectsPool;
    this.askPriceBuckets = new LongAdaptiveRadixTreeMap<>(objectsPool);
    this.bidPriceBuckets = new LongAdaptiveRadixTreeMap<>(objectsPool);
    this.eventsHelper = eventsHelper;
    this.orderIdIndex = new LongAdaptiveRadixTreeMap<>(objectsPool);
    this.logDebug = loggingCfg.getLoggingLevels().contains(LoggingConfiguration.LoggingLevel.LOGGING_MATCHING_DEBUG);

    final int size = bytes.readInt();
    for (int i = 0; i < size; i++) {
        DirectOrder order = new DirectOrder(bytes);
        insertOrder(order, null);
        orderIdIndex.put(order.orderId, order);
    }
}
 
Example 2
Source File: SingleUserReportResult.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
private Position(BytesIn bytes) {

            this.quoteCurrency = bytes.readInt();

            this.direction = PositionDirection.of(bytes.readByte());
            this.openVolume = bytes.readLong();
            this.openPriceSum = bytes.readLong();
            this.profit = bytes.readLong();

            this.pendingSellSize = bytes.readLong();
            this.pendingBuySize = bytes.readLong();
        }
 
Example 3
Source File: CoreSymbolSpecification.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public CoreSymbolSpecification(BytesIn bytes) {
    this.symbolId = bytes.readInt();
    this.type = SymbolType.of(bytes.readByte());
    this.baseCurrency = bytes.readInt();
    this.quoteCurrency = bytes.readInt();
    this.baseScaleK = bytes.readLong();
    this.quoteScaleK = bytes.readLong();
    this.takerFee = bytes.readLong();
    this.makerFee = bytes.readLong();
    this.marginBuy = bytes.readLong();
    this.marginSell = bytes.readLong();
}
 
Example 4
Source File: SymbolPositionRecord.java    From exchange-core with Apache License 2.0 5 votes vote down vote up
public SymbolPositionRecord(long uid, BytesIn bytes) {
    this.uid = uid;

    this.symbol = bytes.readInt();
    this.currency = bytes.readInt();

    this.direction = PositionDirection.of(bytes.readByte());
    this.openVolume = bytes.readLong();
    this.openPriceSum = bytes.readLong();
    this.profit = bytes.readLong();

    this.pendingSellSize = bytes.readLong();
    this.pendingBuySize = bytes.readLong();
}
 
Example 5
Source File: CHMUseCasesTest.java    From Chronicle-Map with Apache License 2.0 5 votes vote down vote up
@Override
public void readMarshallable(@NotNull BytesIn in) throws IllegalStateException {
    long magic = in.readLong();
    if (magic != MAGIC)
        throw new AssertionError("Start " + Long.toHexString(magic));
    text = in.readUTFΔ();
    number = in.readInt();
    long magic2 = in.readLong();
    if (magic2 != MAGIC2)
        throw new AssertionError("End " + Long.toHexString(magic2));
}
 
Example 6
Source File: StateHashReportResult.java    From exchange-core with Apache License 2.0 4 votes vote down vote up
private SubmoduleKey(final BytesIn bytesIn) {
    this.moduleId = bytesIn.readInt();
    this.submodule = SubmoduleType.fromCode(bytesIn.readInt());
}
 
Example 7
Source File: DtoBytesMarshallableTest.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public void readMarshallable(BytesIn bytes) {
    age = bytes.readInt();
    name.setLength(0);
    bytes.readUtf8(name);
}
 
Example 8
Source File: DtoBytesMarshallableTest.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
public void readMarshallable(BytesIn bytes) {
    age = bytes.readInt();
    name.setLength(0);
    bytes.readUtf8(name);
}