/** * Copies bytes into a buffer at the given offset. * * @param target buffer to copy into * @param offset in the target buffer * @throws IndexOutOfBoundsException if the offset is negative or too large */ public void copyTo(byte[] target, int offset) { copyTo(target, 0, offset, size()); }
/** * Copies bytes into a buffer at the given offset. * * @param target buffer to copy into * @param offset in the target buffer * @throws IndexOutOfBoundsException if the offset is negative or too large */ public void copyTo(byte[] target, int offset) { copyTo(target, 0, offset, size()); }
/** * Copies bytes into a buffer at the given offset. * * @param target buffer to copy into * @param offset in the target buffer * @throws IndexOutOfBoundsException if the offset is negative or too large */ public void copyTo(byte[] target, int offset) { copyTo(target, 0, offset, size()); }
/** * Concatenates two strings by copying data values. This is called in a few * cases in order to reduce the growth of the number of tree nodes. * * @param left string on the left * @param right string on the right * @return string formed by copying data bytes */ private static LiteralByteString concatenateBytes(ByteString left, ByteString right) { int leftSize = left.size(); int rightSize = right.size(); byte[] bytes = new byte[leftSize + rightSize]; left.copyTo(bytes, 0, 0, leftSize); right.copyTo(bytes, 0, leftSize, rightSize); return new LiteralByteString(bytes); // Constructor wraps bytes }
/** * Concatenates two strings by copying data values. This is called in a few * cases in order to reduce the growth of the number of tree nodes. * * @param left string on the left * @param right string on the right * @return string formed by copying data bytes */ private static LiteralByteString concatenateBytes(ByteString left, ByteString right) { int leftSize = left.size(); int rightSize = right.size(); byte[] bytes = new byte[leftSize + rightSize]; left.copyTo(bytes, 0, 0, leftSize); right.copyTo(bytes, 0, leftSize, rightSize); return new LiteralByteString(bytes); // Constructor wraps bytes }
/** * Concatenates two strings by copying data values. This is called in a few * cases in order to reduce the growth of the number of tree nodes. * * @param left string on the left * @param right string on the right * @return string formed by copying data bytes */ private static LiteralByteString concatenateBytes(ByteString left, ByteString right) { int leftSize = left.size(); int rightSize = right.size(); byte[] bytes = new byte[leftSize + rightSize]; left.copyTo(bytes, 0, 0, leftSize); right.copyTo(bytes, 0, leftSize, rightSize); return new LiteralByteString(bytes); // Constructor wraps bytes }