| Index: third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
|
| diff --git a/third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc b/third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
|
| similarity index 50%
|
| copy from third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc
|
| copy to third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
|
| index 1b1ab5d1dc7f4bf986884718c67d69a460232ada..97139ca669570f67a9858fb7fca2cbfd6c57ffc7 100644
|
| --- a/third_party/protobuf/python/google/protobuf/pyext/python_protobuf.cc
|
| +++ b/third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java
|
| @@ -28,36 +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: qrczak@google.com (Marcin Kowalczyk)
|
| +package com.google.protobuf;
|
|
|
| -#include <google/protobuf/pyext/python_protobuf.h>
|
| +import java.util.List;
|
|
|
| -namespace google {
|
| -namespace protobuf {
|
| -namespace python {
|
| +/**
|
| + * 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<ByteString>, hence
|
| + * why only these two very specific methods are added.
|
| + *
|
| + * @author jonp@google.com (Jon Perlow)
|
| + */
|
| +public interface LazyStringList extends List<String> {
|
|
|
| -static const Message* GetCProtoInsidePyProtoStub(PyObject* msg) {
|
| - return NULL;
|
| -}
|
| -static Message* MutableCProtoInsidePyProtoStub(PyObject* msg) {
|
| - return NULL;
|
| -}
|
| -
|
| -// This is initialized with a default, stub implementation.
|
| -// If python-google.protobuf.cc is loaded, the function pointer is overridden
|
| -// with a full implementation.
|
| -const Message* (*GetCProtoInsidePyProtoPtr)(PyObject* msg) =
|
| - GetCProtoInsidePyProtoStub;
|
| -Message* (*MutableCProtoInsidePyProtoPtr)(PyObject* msg) =
|
| - MutableCProtoInsidePyProtoStub;
|
| + /**
|
| + * 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 < 0 || index >= size()</tt>)
|
| + */
|
| + ByteString getByteString(int index);
|
|
|
| -const Message* GetCProtoInsidePyProto(PyObject* msg) {
|
| - return GetCProtoInsidePyProtoPtr(msg);
|
| + /**
|
| + * 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);
|
| }
|
| -Message* MutableCProtoInsidePyProto(PyObject* msg) {
|
| - return MutableCProtoInsidePyProtoPtr(msg);
|
| -}
|
| -
|
| -} // namespace python
|
| -} // namespace protobuf
|
| -} // namespace google
|
|
|