Lines Matching refs:bytes
35 /** {@code non-null;} the UTF-8 value as bytes */
36 private final ByteArray bytes;
44 * @return {@code non-null;} the UTF-8 bytes for it
48 byte[] bytes = new byte[len * 3]; // Avoid having to reallocate.
54 bytes[outAt] = (byte) c;
57 bytes[outAt] = (byte) (((c >> 6) & 0x1f) | 0xc0);
58 bytes[outAt + 1] = (byte) ((c & 0x3f) | 0x80);
61 bytes[outAt] = (byte) (((c >> 12) & 0x0f) | 0xe0);
62 bytes[outAt + 1] = (byte) (((c >> 6) & 0x3f) | 0x80);
63 bytes[outAt + 2] = (byte) ((c & 0x3f) | 0x80);
69 System.arraycopy(bytes, 0, result, 0, outAt);
74 * Converts an array of UTF-8 bytes into a string.
76 * @param bytes {@code non-null;} the bytes to convert
79 public static String utf8BytesToString(ByteArray bytes) {
80 int length = bytes.size();
85 int v0 = bytes.getUnsignedByte(at);
106 int v1 = bytes.getUnsignedByte(at + 1);
128 int v1 = bytes.getUnsignedByte(at + 1);
132 int v2 = bytes.getUnsignedByte(at + 2);
186 this.bytes = new ByteArray(stringToUtf8Bytes(string));
190 * Constructs an instance from some UTF-8 bytes.
192 * @param bytes {@code non-null;} array of the UTF-8 bytes
194 public CstUtf8(ByteArray bytes) {
195 if (bytes == null) {
196 throw new NullPointerException("bytes == null");
199 this.bytes = bytes;
200 this.string = utf8BytesToString(bytes).intern();
342 * Gets the UTF-8 value as UTF-8 encoded bytes.
344 * @return {@code non-null;} an array of the UTF-8 bytes
347 return bytes;
352 * get the number of bytes in the UTF-8 encoding of this instance.
357 return bytes.size();