Package akka.protobuf
Interface LazyStringList
-
- All Superinterfaces:
java.util.Collection<java.lang.String>
,java.lang.Iterable<java.lang.String>
,java.util.List<java.lang.String>
- All Known Implementing Classes:
LazyStringArrayList
,UnmodifiableLazyStringList
public interface LazyStringList extends java.util.List<java.lang.String>
An interface extendingList<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.This only adds additional methods that are required for the use in the protocol buffer code in order to be able successfully 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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(ByteString element)
Appends the specified element to the end of this list (optional operation).ByteString
getByteString(int index)
Returns the element at the specified position in this list as a ByteString.java.util.List<?>
getUnderlyingElements()
Returns an unmodifiable List of the underlying elements, each of which is either aString
or its equivalent UTF-8 encodedByteString
.-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
-
-
-
Method Detail
-
getByteString
ByteString getByteString(int index)
Returns the element at the specified position in this list as a ByteString.- Parameters:
index
- index of the element to return- Returns:
- the element at the specified position in this list
- Throws:
java.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()
)
-
add
void add(ByteString element)
Appends the specified element to the end of this list (optional operation).- Parameters:
element
- element to be appended to this list- Throws:
java.lang.UnsupportedOperationException
- if the add operation is not supported by this list
-
getUnderlyingElements
java.util.List<?> getUnderlyingElements()
Returns an unmodifiable List of the underlying elements, each of which is either aString
or its equivalent UTF-8 encodedByteString
. It is an error for the caller to modify the returned List, and attempting to do so will result in anUnsupportedOperationException
.
-
-