Home | History | Annotate | Download | only in protobuf

Lines Matching defs:bytes

89     private final byte[] bytes;
92 bytes = new byte[size];
93 stream = CodedOutputStream.newInstance(bytes);
103 return Arrays.copyOf(bytes, stream.getTotalBytesWritten());
139 byte[] bytes = new byte[dup.remaining()];
140 dup.get(bytes);
141 return bytes;
177 byte[] bytes = new byte[dup.remaining()];
178 dup.get(bytes);
179 return bytes;
233 assertWriteVarint(bytes(0x00), 0);
234 assertWriteVarint(bytes(0x01), 1);
235 assertWriteVarint(bytes(0x7f), 127);
237 assertWriteVarint(bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7));
240 bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b),
246 bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b),
250 bytes(0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49),
255 bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01),
262 assertWriteLittleEndian32(bytes(0x78, 0x56, 0x34, 0x12), 0x12345678);
263 assertWriteLittleEndian32(bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0);
266 bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12), 0x123456789abcdef0L);
268 bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef012345678L);
376 // Write some some bytes (more than the buffer can hold) and verify that totalWritten
394 // Verify that the total bytes written is correct
424 // Write raw bytes into the ByteBuffer.
460 // This will actually write 5 bytes into the CodedOutputStream as the
480 byte[] fullArray = bytes(0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88);
484 assertEqualBytes(OutputType.ARRAY, bytes(0x02, 0x33, 0x44, 0x00), destination);
491 // Generate the expected output if the source string is written 2 bytes at a time.
500 // For each output type, write the source string 2 bytes at a time and verify the output.
561 // Tag is one byte, varint describing string length is 1 byte, string length is 9 bytes.
580 // bytes for the Unicode strings than the ASCII string of the same length.
585 (1 << 7) - 1, // 1 byte for ASCII, 2 bytes for Unicode
586 (1 << 11) - 1, // 2 bytes for ASCII and Unicode
587 (1 << 14) - 1, // 2 bytes for ASCII, 3 bytes for Unicode
589 // 3 bytes for ASCII and Unicode
594 testEncodingOfString(outputType, '\u07FF', i); // 2 bytes per char
595 testEncodingOfString(outputType, '\u0981', i); // 3 bytes per char
610 * Parses the given bytes using writeRawLittleEndian32() and checks
631 * Parses the given bytes using writeRawLittleEndian64() and checks
675 * Helper to construct a byte array from a bunch of bytes. The inputs are
679 private static byte[] bytes(int... bytesAsInts) {
680 byte[] bytes = new byte[bytesAsInts.length];
682 bytes[i] = (byte) bytesAsInts[i];
684 return bytes;
688 private static List<Byte> toList(byte[] bytes) {
690 for (byte b : bytes) {
702 * checks that the result matches the given bytes.
758 byte[] bytes = coder.toByteArray();
760 outputType.name(), bytes.length, CodedOutputStream.computeUInt64SizeNoTag(value));
761 CodedInputStream input = CodedInputStream.newInstance(new ByteArrayInputStream(bytes));
769 byte[] bytes = coder.toByteArray();
771 outputType.name(), bytes.length, CodedOutputStream.computeUInt32SizeNoTag((int) value));
772 CodedInputStream input = CodedInputStream.newInstance(new ByteArrayInputStream(bytes));