@NotNull @Override public Bytes<Void> append8bit(@NotNull CharSequence cs, int start, int end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException { assert singleThreadedAccess(); // check the start. long pos = writePosition(); writeCheckOffset(pos, 0); if (!(cs instanceof String) || pos + (end - start) * 3 + 5 >= safeLimit()) { return super.append8bit(cs, start, end); } return append8bit0((String) cs, start, end - start); }
@Override @NotNull public MappedBytes write8bit(CharSequence s, int start, int length) { assert singleThreadedAccess(); if (s == null) { writeStopBit(-1); return this; } // check the start. long pos = writePosition(); writeCheckOffset(pos, 0); if (!(s instanceof String) || pos + length * 3 + 5 >= safeLimit()) { super.write8bit(s, start, length); return this; } writeStopBit(length); return append8bit0((String) s, start, length); }