Java Code Examples for net.openhft.chronicle.bytes.Bytes#writeLimit()
The following examples show how to use
net.openhft.chronicle.bytes.Bytes#writeLimit() .
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: TcpChannelHub.java From Chronicle-Network with Apache License 2.0 | 5 votes |
private static void logToStandardOutMessageReceived(@NotNull final Wire wire) { @NotNull final Bytes<?> bytes = wire.bytes(); if (!YamlLogging.showClientReads()) return; final long position = bytes.writePosition(); final long limit = bytes.writeLimit(); try { try { // LOG.info("Bytes.toString(bytes)=" + Bytes.toString(bytes)); LOG.info("\nreceives:\n" + "```yaml\n" + Wires.fromSizePrefixedBlobs(wire) + "```\n"); YamlLogging.title = ""; YamlLogging.writeMessage(""); } catch (Exception e) { Jvm.warn().on(TcpChannelHub.class, Bytes.toString(bytes), e); } } finally { bytes.writeLimit(limit); bytes.writePosition(position); } }