public class XmlSource<T> extends FileBasedSource<T>
XmlIO.read()
.FileBasedSource.FileBasedReader<T>, FileBasedSource.Mode
OffsetBasedSource.OffsetBasedReader<T>
BoundedSource.BoundedReader<T>
Source.Reader<T>
Modifier and Type | Method and Description |
---|---|
protected FileBasedSource<T> |
createForSubrangeOfFile(MatchResult.Metadata metadata,
long start,
long end)
Creates and returns a new
FileBasedSource of the same type as the current
FileBasedSource backed by a given file and an offset range. |
protected FileBasedSource.FileBasedReader<T> |
createSingleFileReader(PipelineOptions options)
Creates and returns an instance of a
FileBasedReader implementation for the current
source assuming the source represents a single file. |
Coder<T> |
getDefaultOutputCoder()
Returns the default
Coder to use for the data read from this source. |
void |
populateDisplayData(DisplayData.Builder builder)
Register display data for the given transform or component.
|
void |
validate()
Checks that this source is valid, before it can be used in a pipeline.
|
createReader, createSourceForSubrange, getEstimatedSizeBytes, getFileOrPatternSpec, getFileOrPatternSpecProvider, getMaxEndOffset, getMode, getSingleFileMetadata, isSplittable, split, toString
getBytesPerOffset, getEndOffset, getMinBundleSize, getStartOffset
protected FileBasedSource<T> createForSubrangeOfFile(MatchResult.Metadata metadata, long start, long end)
FileBasedSource
FileBasedSource
of the same type as the current
FileBasedSource
backed by a given file and an offset range. When current source is
being split, this method is used to generate new sub-sources. When creating the source
subclasses must call the constructor #FileBasedSource(Metadata, long, long, long)
of
FileBasedSource
with corresponding parameter values passed here.createForSubrangeOfFile
in class FileBasedSource<T>
metadata
- file backing the new FileBasedSource
.start
- starting byte offset of the new FileBasedSource
.end
- ending byte offset of the new FileBasedSource
. May be Long.MAX_VALUE,
in which case it will be inferred using FileBasedSource.getMaxEndOffset(org.apache.beam.sdk.options.PipelineOptions)
.protected FileBasedSource.FileBasedReader<T> createSingleFileReader(PipelineOptions options)
FileBasedSource
FileBasedReader
implementation for the current
source assuming the source represents a single file. File patterns will be handled by
FileBasedSource
implementation automatically.createSingleFileReader
in class FileBasedSource<T>
public void validate()
Source
It is recommended to use Preconditions
for implementing
this method.
validate
in class FileBasedSource<T>
public void populateDisplayData(DisplayData.Builder builder)
Source
populateDisplayData(DisplayData.Builder)
is invoked by Pipeline runners to collect
display data via DisplayData.from(HasDisplayData)
. Implementations may call
super.populateDisplayData(builder)
in order to register display data in the current
namespace, but should otherwise use subcomponent.populateDisplayData(builder)
to use
the namespace of the subcomponent.
By default, does not register any display data. Implementors may override this method to provide their own display data.
populateDisplayData
in interface HasDisplayData
populateDisplayData
in class FileBasedSource<T>
builder
- The builder to populate with display data.HasDisplayData