Class XmlIO.Read<T>

  • All Implemented Interfaces:
    java.io.Serializable, org.apache.beam.sdk.transforms.display.HasDisplayData
    Enclosing class:
    XmlIO

    public abstract static class XmlIO.Read<T>
    extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,​org.apache.beam.sdk.values.PCollection<T>>
    Implementation of XmlIO.read().
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  XmlIO.Read.CompressionType
      Deprecated.
      Use Compression instead.
    • Field Summary

      • Fields inherited from class org.apache.beam.sdk.transforms.PTransform

        annotations, displayData, name, resourceHints
    • Constructor Summary

      Constructors 
      Constructor Description
      Read()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      org.apache.beam.sdk.values.PCollection<T> expand​(org.apache.beam.sdk.values.PBegin input)  
      XmlIO.Read<T> from​(java.lang.String fileOrPatternSpec)
      Reads a single XML file or a set of XML files defined by a Java "glob" file pattern.
      XmlIO.Read<T> from​(org.apache.beam.sdk.options.ValueProvider<java.lang.String> fileOrPatternSpec)
      Reads a single XML file or a set of XML files defined by a Java "glob" file pattern.
      void populateDisplayData​(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)  
      XmlIO.Read<T> withCharset​(java.nio.charset.Charset charset)
      Sets the XML file charset.
      XmlIO.Read<T> withCompression​(org.apache.beam.sdk.io.Compression compression)
      Decompresses all input files using the specified compression type.
      XmlIO.Read<T> withCompressionType​(XmlIO.Read.CompressionType compressionType)
      XmlIO.Read<T> withMinBundleSize​(long minBundleSize)
      Sets a parameter minBundleSize for the minimum bundle size of the source.
      XmlIO.Read<T> withRecordClass​(java.lang.Class<T> recordClass)
      Sets a JAXB annotated class that can be populated using a record of the provided XML file.
      XmlIO.Read<T> withRecordElement​(java.lang.String recordElement)
      Sets name of the record element of the XML document.
      XmlIO.Read<T> withRootElement​(java.lang.String rootElement)
      Sets name of the root element of the XML document.
      XmlIO.Read<T> withValidationEventHandler​(javax.xml.bind.ValidationEventHandler validationEventHandler)
      Sets the ValidationEventHandler to use with JAXB.
      • Methods inherited from class org.apache.beam.sdk.transforms.PTransform

        addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, toString, validate, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Read

        public Read()
    • Method Detail

      • from

        public XmlIO.Read<T> from​(java.lang.String fileOrPatternSpec)
        Reads a single XML file or a set of XML files defined by a Java "glob" file pattern. Each XML file should be of the form defined in XmlIO.read().
      • from

        public XmlIO.Read<T> from​(org.apache.beam.sdk.options.ValueProvider<java.lang.String> fileOrPatternSpec)
        Reads a single XML file or a set of XML files defined by a Java "glob" file pattern. Each XML file should be of the form defined in XmlIO.read(). Using ValueProviders.
      • withRootElement

        public XmlIO.Read<T> withRootElement​(java.lang.String rootElement)
        Sets name of the root element of the XML document. This will be used to create a valid starting root element when initiating a bundle of records created from an XML document. This is a required parameter.
      • withRecordElement

        public XmlIO.Read<T> withRecordElement​(java.lang.String recordElement)
        Sets name of the record element of the XML document. This will be used to determine offset of the first record of a bundle created from the XML document. This is a required parameter.
      • withRecordClass

        public XmlIO.Read<T> withRecordClass​(java.lang.Class<T> recordClass)
        Sets a JAXB annotated class that can be populated using a record of the provided XML file. This will be used when unmarshalling record objects from the XML file. This is a required parameter.
      • withMinBundleSize

        public XmlIO.Read<T> withMinBundleSize​(long minBundleSize)
        Sets a parameter minBundleSize for the minimum bundle size of the source. Please refer to OffsetBasedSource for the definition of minBundleSize. This is an optional parameter.
      • withCompression

        public XmlIO.Read<T> withCompression​(org.apache.beam.sdk.io.Compression compression)
        Decompresses all input files using the specified compression type.
      • withCharset

        public XmlIO.Read<T> withCharset​(java.nio.charset.Charset charset)
        Sets the XML file charset.
      • withValidationEventHandler

        public XmlIO.Read<T> withValidationEventHandler​(javax.xml.bind.ValidationEventHandler validationEventHandler)
        Sets the ValidationEventHandler to use with JAXB. Calling this with a null parameter will cause the JAXB unmarshaller event handler to be unspecified.
      • populateDisplayData

        public void populateDisplayData​(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)
        Specified by:
        populateDisplayData in interface org.apache.beam.sdk.transforms.display.HasDisplayData
        Overrides:
        populateDisplayData in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,​org.apache.beam.sdk.values.PCollection<T>>
      • expand

        public org.apache.beam.sdk.values.PCollection<T> expand​(org.apache.beam.sdk.values.PBegin input)
        Specified by:
        expand in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PBegin,​org.apache.beam.sdk.values.PCollection<T>>