@Test public void testCheckIndexWithWriteBytes() { doTestCheckIndex( (appender, n) -> appender.writeBytes(Bytes.from("Message-" + n))); }
appender.writeBytes(0x421d00000000L, Bytes.from("hellooooo world")); fail(); } catch (IllegalStateException e) {
private Bytes finishSpace() { if (finishSpace == null) { finishSpace = Bytes.from(" "); } finishSpace.readPosition(0); return finishSpace; }
@NotNull public RequestContext queryString(@NotNull String queryString) { if (queryString.isEmpty()) return this; @NotNull WireParser<Void> parser = getWireParser(); Bytes bytes = Bytes.from(queryString); @NotNull QueryWire wire = new QueryWire(bytes); while (bytes.readRemaining() > 0) parser.parseOne(wire, null); return this; }
@org.jetbrains.annotations.NotNull public static Bytes fromHexString(@org.jetbrains.annotations.NotNull String s) { try { Bytes in = Bytes.from(s); Bytes out = Bytes.elasticByteBuffer(); OUTER: while (in.readRemaining() > 0) { in.parseHexLong(); for (int i = 0; i < 16; i++) { if (in.peekUnsignedByte() == ' ') { in.readSkip(1); if (in.peekUnsignedByte() == ' ') break OUTER; } long value = in.parseHexLong(); out.writeByte((byte) value); } if (in.readByte(in.readPosition() - 1) <= ' ') in.readSkip(-1); in.skipTo(StopCharTesters.CONTROL_STOP); } return out; } catch (BufferUnderflowException | BufferOverflowException e) { throw new AssertionError(e); } }