T - the type of the elements of the setpublic class SetCoder<T> extends StandardCoder<java.util.Set<T>>
Coder.Context| Modifier and Type | Method and Description |
|---|---|
java.util.Set<T> |
decode(java.io.InputStream inStream,
Coder.Context context)
Decodes a value of type
T from the given input stream in
the given context. |
void |
encode(java.util.Set<T> set,
java.io.OutputStream outStream,
Coder.Context context)
Encodes the given value of type
T onto the given output stream
in the given context. |
java.util.List<? extends Coder<?>> |
getCoderArguments()
If this is a
Coder for a parameterized type, returns the
list of Coders being used for each of the parameters, or
returns null if this cannot be done or this is not a
parameterized type. |
Coder<T> |
getElementCoder() |
boolean |
isDeterministic()
Not all sets have a deterministic encoding.
|
static <T> SetCoder<T> |
of(Coder<T> elementCoder)
Produces a SetCoder with the given elementCoder.
|
static SetCoder<?> |
of(java.util.List<java.lang.Object> components) |
void |
registerByteSizeObserver(java.util.Set<T> set,
com.google.cloud.dataflow.sdk.util.common.ElementByteSizeObserver observer,
Coder.Context context)
Notifies ElementByteSizeObserver about the byte size of the encoded value using this coder.
|
asCloudObject, equals, getComponents, getEncodedElementByteSize, hashCode, isRegisterByteSizeObserverCheap, toStringpublic static <T> SetCoder<T> of(Coder<T> elementCoder)
public static SetCoder<?> of(java.util.List<java.lang.Object> components)
public void encode(java.util.Set<T> set, java.io.OutputStream outStream, Coder.Context context) throws java.io.IOException, CoderException
CoderT onto the given output stream
in the given context.java.io.IOException - if writing to the OutputStream fails
for some reasonCoderException - if the value could not be encoded for some reasonpublic java.util.Set<T> decode(java.io.InputStream inStream, Coder.Context context) throws java.io.IOException, CoderException
CoderT from the given input stream in
the given context. Returns the decoded value.java.io.IOException - if reading from the InputStream fails
for some reasonCoderException - if the value could not be decoded for some reasonpublic java.util.List<? extends Coder<?>> getCoderArguments()
CoderCoder for a parameterized type, returns the
list of Coders being used for each of the parameters, or
returns null if this cannot be done or this is not a
parameterized type.public boolean isDeterministic()
For example, HashSet comparison does not depend on element order, so two HashSet instances may be equal but produce different encodings.
public void registerByteSizeObserver(java.util.Set<T> set, com.google.cloud.dataflow.sdk.util.common.ElementByteSizeObserver observer, Coder.Context context) throws java.lang.Exception
registerByteSizeObserver in interface Coder<java.util.Set<T>>registerByteSizeObserver in class StandardCoder<java.util.Set<T>>java.lang.Exception