public class ByteStringCoder extends AtomicCoder<com.google.protobuf.ByteString>
Coder for ByteString objects based on their encoded Protocol Buffer form.
When this code is used in a nested Coder.Context, the serialized ByteString
objects are first delimited by their size.
Coder.Context, Coder.NonDeterministicException| Modifier and Type | Method and Description |
|---|---|
boolean |
consistentWithEquals() |
com.google.protobuf.ByteString |
decode(InputStream inStream) |
com.google.protobuf.ByteString |
decode(InputStream inStream,
Coder.Context context) |
void |
encode(com.google.protobuf.ByteString value,
OutputStream outStream) |
void |
encode(com.google.protobuf.ByteString value,
OutputStream outStream,
Coder.Context context) |
protected long |
getEncodedElementByteSize(com.google.protobuf.ByteString value) |
TypeDescriptor<com.google.protobuf.ByteString> |
getEncodedTypeDescriptor() |
boolean |
isRegisterByteSizeObserverCheap(com.google.protobuf.ByteString value) |
static ByteStringCoder |
of() |
void |
verifyDeterministic() |
equals, getCoderArguments, getComponents, hashCodestructuralValue, toStringregisterByteSizeObserver, verifyDeterministic, verifyDeterministicpublic static ByteStringCoder of()
public void encode(com.google.protobuf.ByteString value,
OutputStream outStream)
throws IOException,
CoderException
encode in class Coder<com.google.protobuf.ByteString>IOExceptionCoderExceptionpublic void encode(com.google.protobuf.ByteString value,
OutputStream outStream,
Coder.Context context)
throws IOException,
CoderException
encode in class Coder<com.google.protobuf.ByteString>IOExceptionCoderExceptionpublic com.google.protobuf.ByteString decode(InputStream inStream) throws IOException
decode in class Coder<com.google.protobuf.ByteString>IOExceptionpublic com.google.protobuf.ByteString decode(InputStream inStream, Coder.Context context) throws IOException
decode in class Coder<com.google.protobuf.ByteString>IOExceptionprotected long getEncodedElementByteSize(com.google.protobuf.ByteString value)
throws Exception
getEncodedElementByteSize in class Coder<com.google.protobuf.ByteString>Exceptionpublic void verifyDeterministic()
verifyDeterministic in class AtomicCoder<com.google.protobuf.ByteString>public boolean consistentWithEquals()
Returns true; the encoded output of two invocations of ByteStringCoder in the same
Coder.Context will be identical if and only if the original ByteString objects
are equal according to Object.equals(java.lang.Object).
consistentWithEquals in class StructuredCoder<com.google.protobuf.ByteString>public boolean isRegisterByteSizeObserverCheap(com.google.protobuf.ByteString value)
Returns true. ByteString.size() returns the size of an array and a VarInt.
isRegisterByteSizeObserverCheap in class Coder<com.google.protobuf.ByteString>public TypeDescriptor<com.google.protobuf.ByteString> getEncodedTypeDescriptor()
getEncodedTypeDescriptor in class StructuredCoder<com.google.protobuf.ByteString>Copyright © 2016–2017 The Apache Software Foundation. All rights reserved.