Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1575)

Unified Diff: third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java

Issue 11347026: Check in protobuf java code and generate lite jar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment about java.gypi variables Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
diff --git a/third_party/protobuf/python/google/protobuf/internal/more_messages.proto b/third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
similarity index 50%
copy from third_party/protobuf/python/google/protobuf/internal/more_messages.proto
copy to third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
index c701b4460b761a7f9db44e1159a1aadf7206a64a..97139ca669570f67a9858fb7fca2cbfd6c57ffc7 100644
--- a/third_party/protobuf/python/google/protobuf/internal/more_messages.proto
+++ b/third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
@@ -28,24 +28,45 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: robinson@google.com (Will Robinson)
+package com.google.protobuf;
+import java.util.List;
-package google.protobuf.internal;
+/**
+ * An interface extending List<String> that also provides access to the
+ * items of the list as UTF8-encoded ByteString objects. This is used by the
+ * protocol buffer implementation to support lazily converting bytes parsed
+ * over the wire to String objects until needed and also increases the
+ * efficiency of serialization if the String was never requested as the
+ * ByteString is already cached.
+ * <p>
+ * This only adds additional methods that are required for the use in the
+ * protocol buffer code in order to be able successfuly round trip byte arrays
+ * through parsing and serialization without conversion to strings. It's not
+ * attempting to support the functionality of say List&ltByteString&gt, hence
+ * why only these two very specific methods are added.
+ *
+ * @author jonp@google.com (Jon Perlow)
+ */
+public interface LazyStringList extends List<String> {
-// A message where tag numbers are listed out of order, to allow us to test our
-// canonicalization of serialized output, which should always be in tag order.
-// We also mix in some extensions for extra fun.
-message OutOfOrderFields {
- optional sint32 optional_sint32 = 5;
- extensions 4 to 4;
- optional uint32 optional_uint32 = 3;
- extensions 2 to 2;
- optional int32 optional_int32 = 1;
-};
+ /**
+ * Returns the element at the specified position in this list as a ByteString.
+ *
+ * @param index index of the element to return
+ * @return the element at the specified position in this list
+ * @throws IndexOutOfBoundsException if the index is out of range
+ * (<tt>index &lt; 0 || index &gt;= size()</tt>)
+ */
+ ByteString getByteString(int index);
-
-extend OutOfOrderFields {
- optional uint64 optional_uint64 = 4;
- optional int64 optional_int64 = 2;
+ /**
+ * Appends the specified element to the end of this list (optional
+ * operation).
+ *
+ * @param element element to be appended to this list
+ * @throws UnsupportedOperationException if the <tt>add</tt> operation
+ * is not supported by this list
+ */
+ void add(ByteString element);
}

Powered by Google App Engine
This is Rietveld 408576698