Class XCasWriterCasConsumer

  • All Implemented Interfaces:
    CasObjectProcessor, CasProcessor, CasConsumer, ConfigurableResource, Resource

    public class XCasWriterCasConsumer
    extends CasConsumer_ImplBase
    A simple CAS consumer that generates XCAS (XML representation of the CAS) files in the filesystem. The output files are written using the UTF-8 charset.

    This CAS Consumer takes one parameters:

    • OutputDirectory - path to directory into which output files will be written

    The XML descriptor for this collection reader is stored in the uima.jar file as org/apache/uima/util/XCasWriterCasConsumer.xml. It can be accessed via the static method getDescription(), which parses the descriptor and returns a CasConsumerDescription object.

    • Field Detail

      • PARAM_OUTPUTDIR

        public static final java.lang.String PARAM_OUTPUTDIR
        Name of configuration parameter that must be set to the path of a directory into which the output files will be written.
        See Also:
        Constant Field Values
      • mOutputDir

        private java.io.File mOutputDir
      • mDocNum

        private int mDocNum
    • Constructor Detail

      • XCasWriterCasConsumer

        public XCasWriterCasConsumer()
    • Method Detail

      • writeXCas

        private void writeXCas​(CAS aCas,
                               java.io.File name)
                        throws java.io.IOException,
                               org.xml.sax.SAXException
        Serialize a CAS to a file in XCAS format
        Parameters:
        aCas - CAS to serialize
        name - output file
        Throws:
        java.io.IOException - if an I/O failure occurs
        org.xml.sax.SAXException - if an error occurs generating the XML text
      • getDescription

        public static CasConsumerDescription getDescription()
                                                     throws InvalidXMLException
        Parses and returns the descriptor for this collection reader. The descriptor is stored in the uima.jar file and located using the ClassLoader.
        Returns:
        an object containing all of the information parsed from the descriptor.
        Throws:
        InvalidXMLException - if the descriptor is invalid or missing
      • getDescriptorURL

        public static java.net.URL getDescriptorURL()