void (final ByteBuffer target, final int offset, final int newLength) { if (newLength < 0 || newLength > MAX_CAPACITY) { throw new IllegalArgumentException("length(" + newLength + ") must be in [0, " + MAX_CAPACITY + "]"); } final byte headerByte1 = (byte)newLength; target.put(offset + 1, headerByte1); }