public class DataStreams
extends java.lang.Object
inbound(Iterator)
treats multiple ByteString
s as a single input stream and
outbound(OutputChunkConsumer)
treats a single OutputStream
as multiple ByteString
s.Modifier and Type | Class and Description |
---|---|
static class |
DataStreams.BlockingQueueIterator<T>
Allows for one or more writing threads to append values to this iterator while one reading
thread reads values.
|
static class |
DataStreams.DataStreamDecoder<T>
|
static class |
DataStreams.ElementDelimitedOutputStream
An adapter which wraps an
DataStreams.OutputChunkConsumer as an OutputStream . |
static interface |
DataStreams.OutputChunkConsumer<T>
A callback which is invoked whenever the
outbound(org.apache.beam.sdk.fn.stream.DataStreams.OutputChunkConsumer<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString>) OutputStream becomes full. |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_OUTBOUND_BUFFER_LIMIT_BYTES |
Constructor and Description |
---|
DataStreams() |
Modifier and Type | Method and Description |
---|---|
static java.io.InputStream |
inbound(java.util.Iterator<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString> bytes)
Converts multiple
ByteString s into a single InputStream . |
static DataStreams.ElementDelimitedOutputStream |
outbound(DataStreams.OutputChunkConsumer<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString> consumer)
Converts a single element delimited
OutputStream into multiple ByteStrings . |
static DataStreams.ElementDelimitedOutputStream |
outbound(DataStreams.OutputChunkConsumer<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString> consumer,
int maximumChunkSize)
Converts a single element delimited
OutputStream into multiple ByteStrings using the specified maximum chunk size. |
public static final int DEFAULT_OUTBOUND_BUFFER_LIMIT_BYTES
public static java.io.InputStream inbound(java.util.Iterator<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString> bytes)
ByteString
s into a single InputStream
.
The iterator is accessed lazily. The supplied Iterator
should block until either it
knows that no more values will be provided or it has the next ByteString
.
Note that this InputStream
follows the Beam Fn API specification for forcing values
that decode consuming zero bytes to consuming exactly one byte.
public static DataStreams.ElementDelimitedOutputStream outbound(DataStreams.OutputChunkConsumer<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString> consumer)
OutputStream
into multiple ByteStrings
.
Note that users must call DataStreams.ElementDelimitedOutputStream.delimitElement()
after each
element.
Note that this OutputStream
follows the Beam Fn API specification for forcing values
that encode producing zero bytes to produce exactly one byte.
public static DataStreams.ElementDelimitedOutputStream outbound(DataStreams.OutputChunkConsumer<org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.ByteString> consumer, int maximumChunkSize)
OutputStream
into multiple ByteStrings
using the specified maximum chunk size.
Note that users must call DataStreams.ElementDelimitedOutputStream.delimitElement()
after each
element.
Note that this OutputStream
follows the Beam Fn API specification for forcing values
that encode producing zero bytes to produce exactly one byte.