public static class WindowedValue.ParamWindowedValueCoder<T> extends WindowedValue.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 WindowedValue.ParamWindowedValueCoder<?> |
fromComponents(java.util.List<Coder<?>> components,
byte[] payload)
|
PaneInfo |
getPane() |
static byte[] |
getPayload(WindowedValue.ParamWindowedValueCoder<?> from)
Returns the serialized payload that will be provided when deserializing this coder.
|
org.joda.time.Instant |
getTimestamp() |
java.util.Collection<? extends BoundedWindow> |
getWindows() |
static <T> WindowedValue.ParamWindowedValueCoder<T> |
of(Coder<T> valueCoder)
Returns the
WindowedValue.ParamWindowedValueCoder for the given valueCoder and GlobalWindow.Coder#INSTANCE using BoundedWindow.TIMESTAMP_MIN_VALUE as the
timestamp, WindowedValue.GLOBAL_WINDOWS as the window and PaneInfo.NO_FIRING as the pane
info for parameters. |
static <T> WindowedValue.ParamWindowedValueCoder<T> |
of(Coder<T> valueCoder,
Coder<? extends BoundedWindow> windowCoder)
Returns the
WindowedValue.ParamWindowedValueCoder for the given valueCoder and windowCoder using
BoundedWindow.TIMESTAMP_MIN_VALUE as the timestamp, WindowedValue.GLOBAL_WINDOWS as the
window and PaneInfo.NO_FIRING as the pane info for parameters. |
static <T> WindowedValue.ParamWindowedValueCoder<T> |
of(Coder<T> valueCoder,
Coder<? extends BoundedWindow> windowCoder,
org.joda.time.Instant timestamp,
java.util.Collection<? extends BoundedWindow> windows,
PaneInfo pane)
Returns the
WindowedValue.ParamWindowedValueCoder for the given valueCoder and windowCoder using
the supplied parameterized timestamp, windows and pane info for WindowedValue . |
void |
registerByteSizeObserver(WindowedValue<T> value,
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> WindowedValue.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, getWindowsCoder
getValueCoder
equals, hashCode, toString
consistentWithEquals, getEncodedElementByteSize, getEncodedTypeDescriptor, isRegisterByteSizeObserverCheap, structuralValue, verifyDeterministic, verifyDeterministic
public static <T> WindowedValue.ParamWindowedValueCoder<T> of(Coder<T> valueCoder, Coder<? extends BoundedWindow> windowCoder, org.joda.time.Instant timestamp, java.util.Collection<? extends BoundedWindow> windows, PaneInfo pane)
WindowedValue.ParamWindowedValueCoder
for the given valueCoder and windowCoder using
the supplied parameterized timestamp, windows and pane info for WindowedValue
.public static <T> WindowedValue.ParamWindowedValueCoder<T> of(Coder<T> valueCoder, Coder<? extends BoundedWindow> windowCoder)
WindowedValue.ParamWindowedValueCoder
for the given valueCoder and windowCoder using
BoundedWindow.TIMESTAMP_MIN_VALUE
as the timestamp, WindowedValue.GLOBAL_WINDOWS
as the
window and PaneInfo.NO_FIRING
as the pane info for parameters.public static <T> WindowedValue.ParamWindowedValueCoder<T> of(Coder<T> valueCoder)
WindowedValue.ParamWindowedValueCoder
for the given valueCoder and GlobalWindow.Coder#INSTANCE
using BoundedWindow.TIMESTAMP_MIN_VALUE
as the
timestamp, WindowedValue.GLOBAL_WINDOWS
as the window and PaneInfo.NO_FIRING
as the pane
info for parameters.public <NewT> WindowedValue.WindowedValueCoder<NewT> withValueCoder(Coder<NewT> valueCoder)
WindowedValue.WindowedValueCoder
WindowedValueCoder
that is a copy of this one, but with a different
value coder.withValueCoder
in class WindowedValue.FullWindowedValueCoder<T>
public void encode(WindowedValue<T> windowedElem, java.io.OutputStream outStream) throws CoderException, java.io.IOException
Coder
T
onto the given output stream.encode
in class WindowedValue.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
Coder
T
onto the given output stream in the given context.encode
in class WindowedValue.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
Coder
T
from the given input stream in the given context. Returns the
decoded value.decode
in class WindowedValue.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
Coder
T
from the given input stream in the given context. Returns the
decoded value.decode
in class WindowedValue.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
Coder
Coder.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 WindowedValue.FullWindowedValueCoder<T>
Coder.NonDeterministicException
- if this coder is not deterministic.public void registerByteSizeObserver(WindowedValue<T> value, ElementByteSizeObserver observer) throws java.lang.Exception
Coder
ElementByteSizeObserver
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 WindowedValue.FullWindowedValueCoder<T>
java.lang.Exception
public org.joda.time.Instant getTimestamp()
public java.util.Collection<? extends BoundedWindow> getWindows()
public PaneInfo getPane()
public static byte[] getPayload(WindowedValue.ParamWindowedValueCoder<?> from)
public static WindowedValue.ParamWindowedValueCoder<?> fromComponents(java.util.List<Coder<?>> components, byte[] payload)