net.openhft.chronicle.wire.WireIn Java Examples
The following examples show how to use
net.openhft.chronicle.wire.WireIn.
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: WireEchoRequestHandler.java From Chronicle-Network with Apache License 2.0 | 6 votes |
/** * simply reads the csp,tid and payload and sends back the tid and payload * * @param inWire the wire from the client * @param outWire the wire to be sent back to the server * @param sd details about this session */ @Override protected void process(@NotNull WireIn inWire, @NotNull WireOut outWire, @NotNull SessionDetailsProvider sd) { inWire.readDocument(m -> { long tid = inWire.read(() -> "tid").int64(); outWire.writeDocument(true, meta -> meta.write(() -> "tid") .int64(tid)); }, d -> { outWire.writeDocument(false, data -> data.write(() -> "payloadResponse") .text(inWire.read(() -> "payload").text())); }); }
Example #2
Source File: MessageToTextQueueEntryHandler.java From Chronicle-Queue with Apache License 2.0 | 6 votes |
@Override public void accept(final WireIn wireIn, final Consumer<String> messageHandler) { final Bytes<?> serialisedMessage = wireIn.bytes(); final byte dataFormatIndicator = serialisedMessage.readByte(serialisedMessage.readPosition()); String text; if (isBinaryFormat(dataFormatIndicator)) { textConversionTarget.clear(); final BinaryWire binaryWire = new BinaryWire(serialisedMessage); binaryWire.copyTo(wireType.apply(textConversionTarget)); text = textConversionTarget.toString(); } else { text = serialisedMessage.toString(); } messageHandler.accept(text); }
Example #3
Source File: SizedMarshallableDataAccess.java From Chronicle-Map with Apache License 2.0 | 5 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { super.readMarshallable(wireIn); sizedReader = wireIn.read(() -> "sizedReader").object(SizedReader.class); sizedWriter = wireIn.read(() -> "sizedWriter").object(SizedWriter.class); initTransients(DEFAULT_BYTES_CAPACITY); }
Example #4
Source File: MapMarshaller.java From Chronicle-Map with Apache License 2.0 | 5 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { keyReader = wireIn.read(() -> "keyReader").typedMarshallable(); keyWriter = wireIn.read(() -> "keyWriter").typedMarshallable(); valueReader = wireIn.read(() -> "valueReader").typedMarshallable(); valueWriter = wireIn.read(() -> "valueWriter").typedMarshallable(); initTransients(); }
Example #5
Source File: VanillaChronicleMap.java From Chronicle-Map with Apache License 2.0 | 5 votes |
@Override protected void readMarshallableFields(@NotNull WireIn wireIn) { super.readMarshallableFields(wireIn); valueClass = wireIn.read(() -> "valueClass").lenientTypeLiteral(); valueSizeMarshaller = wireIn.read(() -> "valueSizeMarshaller").object(SizeMarshaller.class); valueReader = wireIn.read(() -> "valueReader").object(SizedReader.class); valueDataAccess = wireIn.read(() -> "valueDataAccess").object(DataAccess.class); constantlySizedEntry = wireIn.read(() -> "constantlySizedEntry").bool(); alignment = wireIn.read(() -> "alignment").int32(); worstAlignment = wireIn.read(() -> "worstAlignment").int32(); maxBloatFactor = wireIn.read(() -> "maxBloatFactor").float64(); }
Example #6
Source File: ReplicatedChronicleMap.java From Chronicle-Map with Apache License 2.0 | 5 votes |
@Override protected void readMarshallableFields(@NotNull WireIn wireIn) { super.readMarshallableFields(wireIn); tierModIterBitSetSizeInBits = wireIn.read(() -> "tierModIterBitSetSizeInBits").int64(); tierModIterBitSetOuterSize = wireIn.read(() -> "tierModIterBitSetOuterSize").int64(); segmentModIterBitSetsForIdentifierOuterSize = wireIn.read(() -> "segmentModIterBitSetsForIdentifierOuterSize").int64(); tierBulkModIterBitSetsForIdentifierOuterSize = wireIn.read(() -> "tierBulkModIterBitSetsForIdentifierOuterSize").int64(); changeCount = new AtomicLong(0); }
Example #7
Source File: ExternalBytesMarshallableDataAccess.java From Chronicle-Map with Apache License 2.0 | 5 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { super.readMarshallable(wireIn); reader = wireIn.read(() -> "reader").typedMarshallable(); writer = wireIn.read(() -> "writer").typedMarshallable(); initTransients(DEFAULT_BYTES_CAPACITY); }
Example #8
Source File: StatelessTailer.java From Chronicle-Queue with Apache License 2.0 | 5 votes |
/** * The wire associated with the current index, calling this method moves on the index * * @return the wire generated by the {@code wireFunction} and populated with the {@code bytes} */ @Override public WireIn wire() { if (index == -1) { index = statelessRawBytesTailer.lastWrittenIndex(); } final Bytes bytes = statelessRawBytesTailer.readExcept(index); index++; return wireFunction.apply(bytes); }
Example #9
Source File: DummyMethodReaderQueueEntryHandler.java From Chronicle-Queue with Apache License 2.0 | 5 votes |
@Override public void accept(final WireIn wireIn, final Consumer<String> messageHandler) { long elementCount = 0; while (wireIn.hasMore()) { new BinaryWire(wireIn.bytes()).copyOne(wireType.apply(textConversionTarget)); elementCount++; if ((elementCount & 1) == 0) { messageHandler.accept(textConversionTarget.toString()); textConversionTarget.clear(); } } }
Example #10
Source File: HeartbeatHandler.java From Chronicle-Network with Apache License 2.0 | 5 votes |
@UsedViaReflection public HeartbeatHandler(@NotNull WireIn w) { heartbeatTimeoutMs = w.read("heartbeatTimeoutMs").int64(); heartbeatIntervalMs = w.read("heartbeatIntervalMs").int64(); assert heartbeatTimeoutMs >= 1000 : "heartbeatTimeoutMs=" + heartbeatTimeoutMs + ", this is too small"; assert heartbeatIntervalMs >= 500 : "heartbeatIntervalMs=" + heartbeatIntervalMs + ", this is too small"; onMessageReceived(); }
Example #11
Source File: MethodReaderQueueEntryHandler.java From Chronicle-Queue with Apache License 2.0 | 5 votes |
@Override public void accept(final WireIn wireIn, final Consumer<String> messageHandler) { MethodReader methodReader = wireIn.methodReader(Mocker.intercepting(mrInterface, "", s -> { long hn = wireIn.headerNumber(); messageHandler.accept("header: " + hn + "\n" + s); })); while (methodReader.readOne()) { // read all } }
Example #12
Source File: SCQMeta.java From Chronicle-Queue with Apache License 2.0 | 5 votes |
@SuppressWarnings("unused") @UsedViaReflection SCQMeta(@NotNull WireIn wire) { this.roll = Objects.requireNonNull(wire.read(MetaDataField.roll).typedMarshallable()); this.deltaCheckpointInterval = wire.bytes().readRemaining() > 0 ? wire.read(MetaDataField.deltaCheckpointInterval).int32() : -1; // disabled. this.sourceId = wire.bytes().readRemaining() > 0 ? wire.read(MetaDataField.sourceId).int32() : 0; }
Example #13
Source File: SessionDetailsProvider.java From Chronicle-Network with Apache License 2.0 | 5 votes |
@Override default void readMarshallable(@NotNull WireIn wire) throws IORuntimeException { userId(wire.read(EventId.userId).text()); domain(wire.read(EventId.domain).text()); sessionMode(wire.read(EventId.sessionMode).object(SessionMode.class)); securityToken(wire.read(EventId.securityToken).text()); @Nullable final String uid = wire.read(EventId.clientId).text(); if (uid != null) clientId(UUID.fromString(uid)); wireType(wire.read(EventId.wireType).object(WireType.class)); hostId(wire.read(EventId.hostId).int8()); }
Example #14
Source File: OrderCancelReject.java From Chronicle-Queue-Demo with Apache License 2.0 | 5 votes |
@Override public void readMarshallable(WireIn in) { super.readMarshallable(in); if (PREGENERATED_MARSHALLABLE) { clOrdID = in.read("clOrdID").object(clOrdID, String.class); symbol = in.read("symbol").readLong(Base85LongConverter.INSTANCE); reason = in.read("reason").object(reason, String.class); } }
Example #15
Source File: CancelOrderRequest.java From Chronicle-Queue-Demo with Apache License 2.0 | 5 votes |
@Override public void readMarshallable(WireIn in) { super.readMarshallable(in); if (PREGENERATED_MARSHALLABLE) { clOrdID = in.read("clOrdID").object(clOrdID, String.class); symbol = in.read("symbol").readLong(Base85LongConverter.INSTANCE); } }
Example #16
Source File: SingleTailer.java From Chronicle-Queue with Apache License 2.0 | 4 votes |
@Override public boolean readDocument(Consumer<WireIn> reader) { return wire.readDocument(null, reader); }
Example #17
Source File: CharSequenceCustomEncodingBytesWriter.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { charset = (Charset) wireIn.read(() -> "charset").object(); inputBufferSize = wireIn.read(() -> "inputBufferSize").int32(); initTransients(); }
Example #18
Source File: QueueTailerResponse.java From Chronicle-Queue with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(WireIn wire) throws IllegalStateException { super.readMarshallable(wire); wire.read(() -> "start").int64(x -> start = x); }
Example #19
Source File: QueueAppenderResponse.java From Chronicle-Queue with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(WireIn wire) throws IllegalStateException { wire.read(CoreFields.csp).text(csp) .read(CoreFields.cid).int32(x -> cid = x); }
Example #20
Source File: SingleTailer.java From Chronicle-Queue with Apache License 2.0 | 4 votes |
@Override public WireIn wire() { return wire; }
Example #21
Source File: HashSplitting.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wire) { bits = wire.read(() -> "bits").int32(); mask = (1 << bits) - 1; }
Example #22
Source File: ByteBufferDataAccess.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { // no fields to read initTransients(); }
Example #23
Source File: LongDataAccess.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { // no config fields to read initTransients(); }
Example #24
Source File: InstanceCreatingMarshaller.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { //noinspection unchecked tClass = wireIn.read(() -> "tClass").lenientTypeLiteral(); }
Example #25
Source File: BytesAsSizedReader.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { reader = wireIn.read(() -> "reader").typedMarshallable(); }
Example #26
Source File: IntegerDataAccess.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { // no config fields to read initTransients(); }
Example #27
Source File: IntegerDataAccess_3_13.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { // no config fields to read initTransients(); }
Example #28
Source File: EnumMarshallable.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override default void readMarshallable(@NotNull WireIn wireIn) { // shouldn't read fields, anyway readResolved later }
Example #29
Source File: DoubleDataAccess.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { // no config fields to read initTransients(); }
Example #30
Source File: CharSequenceSizedReader.java From Chronicle-Map with Apache License 2.0 | 4 votes |
@Override public void readMarshallable(@NotNull WireIn wireIn) { // no fields to read }