Java Code Examples for net.openhft.chronicle.bytes.Bytes#skip()
The following examples show how to use
net.openhft.chronicle.bytes.Bytes#skip() .
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: QueueDumpMain.java From Chronicle-Queue with Apache License 2.0 | 6 votes |
public static void dump(File filename, PrintWriter pw) throws FileNotFoundException { MappedFile mappedFile = MappedFile.mappedFile(filename, 64 << 20, 16 << 20); Bytes bytes = mappedFile.bytes(); pw.print("# Magic: "); for (int i = 0; i < 8; i++) pw.print((char) bytes.readUnsignedByte()); pw.println(); while (true) { long spb = bytes.readUnsignedInt(); if (!Wires.isKnownLength(spb)) break; pw.print("--- !"); pw.print(SBP_TYPES[((int) (spb >>> 30))]); pw.println(); long start = bytes.position(); BytesUtil.toString(bytes, pw, start, start, start + Wires.lengthOf(spb)); pw.println(); bytes.skip(Wires.lengthOf(spb)); } pw.flush(); }
Example 2
Source File: BytesRingBuffer.java From Chronicle-Queue with Apache License 2.0 | 6 votes |
/** * @param buffer the bytes for the header */ private Header(@NotNull Bytes buffer) { if (buffer.remaining() < 24) { final String message = "buffer too small, buffer size=" + buffer.remaining(); throw new IllegalStateException(message); } readLocationOffset = buffer.position(); buffer.skip(8); writeLocationOffset = buffer.position(); buffer.skip(8); writeUpToOffset = buffer.position(); buffer.skip(8); this.buffer = buffer.bytes(); }