@Override protected <T> void mergeFrom(InputStream in, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(in, message, schema); }
@Override protected <T> void mergeFrom(InputStream in, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(in, message, schema); }
@Override protected <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(data, offset, length, message, schema); }
@Override protected <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(data, offset, length, message, schema); }
@Override protected <T> void mergeFrom(InputStream in, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(in, message, schema); }
@Override protected <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(data, offset, length, message, schema); }
@Override public <T extends Map<String, String>> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(data, offset, length, message, schema); }
@Override protected <T> void mergeFrom(InputStream in, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(in, message, schema); }
@Override protected <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(data, offset, length, message, schema); }
@Override protected <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(data, offset, length, message, schema); }
@Override protected <T> void mergeFrom(InputStream in, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(in, message, schema); }
@Override protected <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema) throws IOException { ProtobufIOUtil.mergeFrom(data, offset, length, message, schema); }
@Benchmark public Int10 runtime_deserialize_10_int_field() throws Exception { Int10 int10 = new Int10(); ProtobufIOUtil.mergeFrom(data_10_int, int10, int10RuntimeSchema); return int10; }
@Benchmark public SparseInt1 runtime_sparse_deserialize_1_int_field() throws Exception { SparseInt1 int1 = new SparseInt1(); ProtobufIOUtil.mergeFrom(data_1_int, int1, sparseInt1RuntimeSchema); return int1; }
@Benchmark public Int1 runtime_deserialize_1_int_field() throws Exception { Int1 int1 = new Int1(); ProtobufIOUtil.mergeFrom(data_1_int, int1, int1RuntimeSchema); return int1; }
@Benchmark public SparseInt10 runtime_sparse_deserialize_10_int_field() throws Exception { SparseInt10 int10 = new SparseInt10(); ProtobufIOUtil.mergeFrom(data_10_int, int10, sparseInt10RuntimeSchema); return int10; }
@Benchmark public GeneratedInt1 generated_deserialize_1_int_field() throws Exception { GeneratedInt1 int1 = new GeneratedInt1(); ProtobufIOUtil.mergeFrom(data_1_int, int1, GeneratedInt1.getSchema()); return int1; }
@Benchmark public GeneratedInt10 generated_deserialize_10_int_field() throws Exception { GeneratedInt10 int10 = new GeneratedInt10(); ProtobufIOUtil.mergeFrom(data_10_int, int10, GeneratedInt10.getSchema()); return int10; }
static void verifyProtobuf(PojoWithInts p) throws IOException { Schema<PojoWithInts> schema = PojoWithInts.getSchema(); byte[] data = ProtobufIOUtil.toByteArray(p, schema, buf()); PojoWithInts pFromByteArray = new PojoWithInts(); ProtobufIOUtil.mergeFrom(data, pFromByteArray, schema); assertEquals(p, pFromByteArray); ByteArrayOutputStream out = new ByteArrayOutputStream(); ProtobufIOUtil.writeTo(out, p, schema, buf()); byte[] dataFromStream = out.toByteArray(); assertTrue(Arrays.equals(data, dataFromStream)); ByteArrayInputStream in = new ByteArrayInputStream(data); PojoWithInts pFromStream = new PojoWithInts(); ProtobufIOUtil.mergeFrom(in, pFromStream, schema); assertEquals(p, pFromStream); }
public void testProtobuf() throws Exception { Schema<Zoo> schema = RuntimeSchema.getSchema(Zoo.class); Zoo p = filledZoo(); byte[] data = ProtobufIOUtil.toByteArray(p, schema, buf()); // System.err.println("protobuf: " + data.length); Zoo p2 = new Zoo(); ProtobufIOUtil.mergeFrom(data, p2, schema); assertEquals(p, p2); List<Zoo> list = new ArrayList<Zoo>(); list.add(p); list.add(p2); ByteArrayOutputStream out = new ByteArrayOutputStream(); ProtobufIOUtil.writeListTo(out, list, schema, buf()); byte[] listData = out.toByteArray(); ByteArrayInputStream in = new ByteArrayInputStream(listData); List<Zoo> parsedList = ProtobufIOUtil.parseListFrom(in, schema); assertEquals(list, parsedList); }