auto import from //depot/cupcake/@137055

pull/91/head
The Android Open Source Project 16 years ago
parent 52067f67ad
commit bb7bbd7c9c
  1. 34
      src/com/google/common/io/protocol/ProtoBuf.java

@ -144,6 +144,28 @@ public class ProtoBuf {
insertProtoBuf(tag, getCount(tag), value); insertProtoBuf(tag, getCount(tag), value);
} }
/**
* Adds a new protobuf for the specified tag, setting the child protobuf's
* type correctly for the tag.
* @param tag the tag for which to create a new protobuf
* @return the newly created protobuf
*/
public ProtoBuf addNewProtoBuf(int tag) {
ProtoBuf child = newProtoBufForTag(tag);
addProtoBuf(tag, child);
return child;
}
/**
* Creates and returns a new protobuf for the specified tag, setting the new
* protobuf's type correctly for the tag.
* @param tag the tag for which to create a new protobuf
* @return the newly created protobuf
*/
public ProtoBuf newProtoBufForTag(int tag) {
return new ProtoBuf((ProtoBufType) msgType.getData(tag));
}
/** /**
* Appends the given (repeated) tag with the given String value. * Appends the given (repeated) tag with the given String value.
*/ */
@ -729,6 +751,18 @@ public class ProtoBuf {
setObject(tag, pb); setObject(tag, pb);
} }
/**
* Sets a new protobuf for the specified tag, setting the child protobuf's
* type correctly for the tag.
* @param tag the tag for which to create a new protobuf
* @return the newly created protobuf
*/
public ProtoBuf setNewProtoBuf(int tag) {
ProtoBuf child = newProtoBufForTag(tag);
setProtoBuf(tag, child);
return child;
}
/** /**
* Sets the given tag to the given String value. * Sets the given tag to the given String value.
*/ */

Loading…
Cancel
Save