Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb9f736a authored by Joe Onorato's avatar Joe Onorato
Browse files

ProtoOutputStream convenience methods.

- Add a set of write methods to ProtoOutputStream that figure out the type.
  The other methods are doing all the type checking anyway, so this won't be
  much slower, and it's way easier to use.  The expected java type casts
  that people would do anyway happen inside.
- Add writeObject and writeRepeatedObject methods that write a pre-encoded
  object.
- Add a constructor that takes an OutputStream, and a flush() method.  Right
  now, all the data gets flushed at the end, but given this API it would be
  possible to write smaller chunks at the object boundaries and do more
  sophisticated buffering.

Test: CTS
Change-Id: Ieb852092d3d65812c81139558151de9e3f467dc8
parent b38ac0b1
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -41525,11 +41525,15 @@ package android.util.proto {
  public final class ProtoOutputStream {
    ctor public ProtoOutputStream();
    ctor public ProtoOutputStream(int);
    ctor public ProtoOutputStream(java.io.OutputStream);
    ctor public ProtoOutputStream(java.io.FileDescriptor);
    method public static int checkFieldId(long, long);
    method public static int convertObjectIdToOrdinal(int);
    method public void dump(java.lang.String);
    method public void end(long);
    method public void endObject(long);
    method public void endRepeatedObject(long);
    method public void flush();
    method public byte[] getBytes();
    method public static int getDepthFromToken(long);
    method public static int getObjectIdFromToken(long);
@@ -41538,9 +41542,17 @@ package android.util.proto {
    method public static int getTagSizeFromToken(long);
    method public static long makeFieldId(int, long);
    method public static long makeToken(int, boolean, int, int, int);
    method public long start(long);
    method public long startObject(long);
    method public long startRepeatedObject(long);
    method public static java.lang.String token2String(long);
    method public void write(long, double);
    method public void write(long, float);
    method public void write(long, int);
    method public void write(long, long);
    method public void write(long, boolean);
    method public void write(long, java.lang.String);
    method public void write(long, byte[]);
    method public void writeBool(long, boolean);
    method public void writeBytes(long, byte[]);
    method public void writeDouble(long, double);
@@ -41550,6 +41562,8 @@ package android.util.proto {
    method public void writeFloat(long, float);
    method public void writeInt32(long, int);
    method public void writeInt64(long, long);
    method public void writeObject(long, byte[]);
    method public void writeObjectImpl(int, byte[]);
    method public void writePackedBool(long, boolean[]);
    method public void writePackedDouble(long, double[]);
    method public void writePackedEnum(long, int[]);
@@ -41573,6 +41587,8 @@ package android.util.proto {
    method public void writeRepeatedFloat(long, float);
    method public void writeRepeatedInt32(long, int);
    method public void writeRepeatedInt64(long, long);
    method public void writeRepeatedObject(long, byte[]);
    method public void writeRepeatedObjectImpl(int, byte[]);
    method public void writeRepeatedSFixed32(long, int);
    method public void writeRepeatedSFixed64(long, long);
    method public void writeRepeatedSInt32(long, int);
+903 −0

File changed.

Preview size limit exceeded, changes collapsed.