Java Code Examples for net.openhft.chronicle.bytes.Bytes#toString()
The following examples show how to use
net.openhft.chronicle.bytes.Bytes#toString() .
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: TcpChannelHub.java From Chronicle-Network with Apache License 2.0 | 6 votes |
private static void logToStandardOutMessageReceivedInERROR(@NotNull final Wire wire) { @NotNull final Bytes<?> bytes = wire.bytes(); final long position = bytes.writePosition(); final long limit = bytes.writeLimit(); try { try { LOG.info("\nreceives IN ERROR:\n" + "```yaml\n" + Wires.fromSizePrefixedBlobs(wire) + "```\n"); YamlLogging.title = ""; YamlLogging.writeMessage(""); } catch (Exception e) { String x = Bytes.toString(bytes); Jvm.warn().on(TcpChannelHub.class, x, e); } } finally { bytes.writeLimit(limit); bytes.writePosition(position); } }
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: AbstractStatelessClient.java From Chronicle-Network with Apache License 2.0 | 5 votes |
private void checkIsData(@NotNull final Wire wireIn) { @NotNull final Bytes<?> bytes = wireIn.bytes(); int dataLen = bytes.readVolatileInt(); if (!Wires.isData(dataLen)) throw new IllegalStateException("expecting a data blob, from ->" + Bytes.toString (bytes, 0, bytes.readLimit())); }