public class ByteStringCoder extends CustomCoder<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,
Coder.Context context) |
void |
encode(com.google.protobuf.ByteString value,
OutputStream outStream,
Coder.Context context) |
protected long |
getEncodedElementByteSize(com.google.protobuf.ByteString value,
Coder.Context context) |
TypeDescriptor<com.google.protobuf.ByteString> |
getEncodedTypeDescriptor() |
boolean |
isRegisterByteSizeObserverCheap(com.google.protobuf.ByteString value,
Coder.Context context) |
static ByteStringCoder |
of() |
void |
verifyDeterministic() |
getCoderArguments, getInstanceComponents, initializeCloudObject, ofasCloudObject, equals, getComponents, hashCode, registerByteSizeObserver, structuralValue, toString, verifyDeterministic, verifyDeterministicpublic static ByteStringCoder of()
public void encode(com.google.protobuf.ByteString value,
OutputStream outStream,
Coder.Context context)
throws IOException,
CoderException
IOExceptionCoderExceptionpublic com.google.protobuf.ByteString decode(InputStream inStream, Coder.Context context) throws IOException
IOExceptionprotected long getEncodedElementByteSize(com.google.protobuf.ByteString value,
Coder.Context context)
throws Exception
getEncodedElementByteSize in class StructuredCoder<com.google.protobuf.ByteString>Exceptionpublic void verifyDeterministic()
verifyDeterministic in interface Coder<com.google.protobuf.ByteString>verifyDeterministic in class CustomCoder<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 interface Coder<com.google.protobuf.ByteString>consistentWithEquals in class StructuredCoder<com.google.protobuf.ByteString>public boolean isRegisterByteSizeObserverCheap(com.google.protobuf.ByteString value,
Coder.Context context)
Returns true. ByteString.size() returns the size of an array and a VarInt.
isRegisterByteSizeObserverCheap in interface Coder<com.google.protobuf.ByteString>isRegisterByteSizeObserverCheap in class StructuredCoder<com.google.protobuf.ByteString>public TypeDescriptor<com.google.protobuf.ByteString> getEncodedTypeDescriptor()
getEncodedTypeDescriptor in interface Coder<com.google.protobuf.ByteString>getEncodedTypeDescriptor in class StructuredCoder<com.google.protobuf.ByteString>Copyright © 2016–2017 The Apache Software Foundation. All rights reserved.