public static class WindowedValues.ParamWindowedValueCoder<T> extends WindowedValues.FullWindowedValueCoder<T>
WindowedValue.
A ParamWindowedValueCoder only encodes and decodes the value. It drops timestamp,
windows, and pane info during encoding, and uses the supplied parameterized timestamp, windows
and pane info values during decoding when reconstructing the windowed value.
Coder.Context, Coder.NonDeterministicException| Modifier and Type | Method and Description |
|---|---|
WindowedValue<T> |
decode(java.io.InputStream inStream)
Decodes a value of type
T from the given input stream in the given context. |
WindowedValue<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(WindowedValue<T> windowedElem,
java.io.OutputStream outStream)
Encodes the given value of type
T onto the given output stream. |
void |
encode(WindowedValue<T> windowedElem,
java.io.OutputStream outStream,
Coder.Context context)
Encodes the given value of type
T onto the given output stream in the given context. |
static WindowedValues.ParamWindowedValueCoder<?> |
fromComponents(java.util.List<Coder<?>> components,
byte[] payload)
|
PaneInfo |
getPaneInfo() |
static byte[] |
getPayload(WindowedValues.ParamWindowedValueCoder<?> from)
Returns the serialized payload that will be provided when deserializing this coder.
|
Instant |
getTimestamp() |
java.util.Collection<? extends BoundedWindow> |
getWindows() |
static <T> WindowedValues.ParamWindowedValueCoder<T> |
of(Coder<T> valueCoder)
Returns the
WindowedValues.ParamWindowedValueCoder for the given valueCoder and GlobalWindow.Coder#INSTANCE using BoundedWindow.TIMESTAMP_MIN_VALUE as the
timestamp, WindowedValues.GLOBAL_WINDOWS as the window and PaneInfo.NO_FIRING as the pane
info for parameters. |
static <T> WindowedValues.ParamWindowedValueCoder<T> |
of(Coder<T> valueCoder,
Coder<? extends BoundedWindow> windowCoder)
Returns the
WindowedValues.ParamWindowedValueCoder for the given valueCoder and windowCoder using
BoundedWindow.TIMESTAMP_MIN_VALUE as the timestamp, WindowedValues.GLOBAL_WINDOWS as the
window and PaneInfo.NO_FIRING as the pane info for parameters. |
static <T> WindowedValues.ParamWindowedValueCoder<T> |
of(Coder<T> valueCoder,
Coder<? extends BoundedWindow> windowCoder,
Instant timestamp,
java.util.Collection<? extends BoundedWindow> windows,
PaneInfo paneInfo)
Returns the
WindowedValues.ParamWindowedValueCoder for the given valueCoder and windowCoder using
the supplied parameterized timestamp, windows and pane info for WindowedValues. |
void |
registerByteSizeObserver(WindowedValue<T> value,
org.apache.beam.sdk.util.common.ElementByteSizeObserver observer)
Notifies the
ElementByteSizeObserver about the byte size of the encoded value using
this Coder. |
void |
verifyDeterministic()
Throw
Coder.NonDeterministicException if the coding is not deterministic. |
<NewT> WindowedValues.WindowedValueCoder<NewT> |
withValueCoder(Coder<NewT> valueCoder)
Returns a new
WindowedValueCoder that is a copy of this one, but with a different
value coder. |
getCoderArguments, getComponents, getWindowCoder, getWindowsCodergetValueCoderequals, hashCode, toStringconsistentWithEquals, getEncodedElementByteSize, getEncodedElementByteSizeUsingCoder, getEncodedTypeDescriptor, isRegisterByteSizeObserverCheap, structuralValue, verifyDeterministic, verifyDeterministicpublic static <T> WindowedValues.ParamWindowedValueCoder<T> of(Coder<T> valueCoder, Coder<? extends BoundedWindow> windowCoder, Instant timestamp, java.util.Collection<? extends BoundedWindow> windows, PaneInfo paneInfo)
WindowedValues.ParamWindowedValueCoder for the given valueCoder and windowCoder using
the supplied parameterized timestamp, windows and pane info for WindowedValues.public static <T> WindowedValues.ParamWindowedValueCoder<T> of(Coder<T> valueCoder, Coder<? extends BoundedWindow> windowCoder)
WindowedValues.ParamWindowedValueCoder for the given valueCoder and windowCoder using
BoundedWindow.TIMESTAMP_MIN_VALUE as the timestamp, WindowedValues.GLOBAL_WINDOWS as the
window and PaneInfo.NO_FIRING as the pane info for parameters.public static <T> WindowedValues.ParamWindowedValueCoder<T> of(Coder<T> valueCoder)
WindowedValues.ParamWindowedValueCoder for the given valueCoder and GlobalWindow.Coder#INSTANCE using BoundedWindow.TIMESTAMP_MIN_VALUE as the
timestamp, WindowedValues.GLOBAL_WINDOWS as the window and PaneInfo.NO_FIRING as the pane
info for parameters.public <NewT> WindowedValues.WindowedValueCoder<NewT> withValueCoder(Coder<NewT> valueCoder)
WindowedValues.WindowedValueCoderWindowedValueCoder that is a copy of this one, but with a different
value coder.withValueCoder in class WindowedValues.FullWindowedValueCoder<T>public void encode(WindowedValue<T> windowedElem, java.io.OutputStream outStream) throws CoderException, java.io.IOException
CoderT onto the given output stream. Multiple elements can
be encoded next to each other on the output stream, each coder should encode information to
know how many bytes to read when decoding. A common approach is to prefix the encoding with the
element's encoded length.encode in class WindowedValues.FullWindowedValueCoder<T>CoderException - if the value could not be encoded for some reasonjava.io.IOException - if writing to the OutputStream fails for some reasonpublic void encode(WindowedValue<T> windowedElem, java.io.OutputStream outStream, Coder.Context context) throws CoderException, java.io.IOException
CoderT onto the given output stream in the given context.encode in class WindowedValues.FullWindowedValueCoder<T>CoderException - if the value could not be encoded for some reasonjava.io.IOException - if writing to the OutputStream fails for some reasonpublic WindowedValue<T> decode(java.io.InputStream inStream) throws CoderException, java.io.IOException
CoderT from the given input stream in the given context. Returns the
decoded value. Multiple elements can be encoded next to each other on the input stream, each
coder should encode information to know how many bytes to read when decoding. A common approach
is to prefix the encoding with the element's encoded length.decode in class WindowedValues.FullWindowedValueCoder<T>CoderException - if the value could not be decoded for some reasonjava.io.IOException - if reading from the InputStream fails for some reasonpublic WindowedValue<T> decode(java.io.InputStream inStream, Coder.Context context) throws CoderException, java.io.IOException
CoderT from the given input stream in the given context. Returns the
decoded value.decode in class WindowedValues.FullWindowedValueCoder<T>CoderException - if the value could not be decoded for some reasonjava.io.IOException - if reading from the InputStream fails for some reasonpublic void verifyDeterministic()
throws Coder.NonDeterministicException
CoderCoder.NonDeterministicException if the coding is not deterministic.
In order for a Coder to be considered deterministic, the following must be true:
Object.equals() or Comparable.compareTo(), if supported) have the same encoding.
Coder always produces a canonical encoding, which is the same for an instance
of an object even if produced on different computers at different times.
verifyDeterministic in class WindowedValues.FullWindowedValueCoder<T>Coder.NonDeterministicException - if this coder is not deterministic.public void registerByteSizeObserver(WindowedValue<T> value, org.apache.beam.sdk.util.common.ElementByteSizeObserver observer) throws java.lang.Exception
CoderElementByteSizeObserver about the byte size of the encoded value using
this Coder.
Not intended to be called by user code, but instead by PipelineRunner
implementations.
By default, this notifies observer about the byte size of the encoded value using
this coder as returned by Coder.getEncodedElementByteSize(T).
registerByteSizeObserver in class WindowedValues.FullWindowedValueCoder<T>java.lang.Exceptionpublic Instant getTimestamp()
public java.util.Collection<? extends BoundedWindow> getWindows()
public PaneInfo getPaneInfo()
public static byte[] getPayload(WindowedValues.ParamWindowedValueCoder<?> from)
public static WindowedValues.ParamWindowedValueCoder<?> fromComponents(java.util.List<Coder<?>> components, byte[] payload)