Class AbstractLineFilter

    • Constructor Detail

      • AbstractLineFilter

        public AbstractLineFilter()
    • Method Detail

      • close

        public final void close()
        Description copied from interface: IFilter
        Closes the input document. Developers should call this method from within their code before sending the last event: This can allow writer objects to overwrite the input file when they receive the last event. This method must also be safe to call even if the input document is not opened.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface IFilter
        Overrides:
        close in class AbstractFilter
      • hasNext

        public boolean hasNext()
        Description copied from interface: IFilter
        Indicates if there is an event to process.

        Implementer Note: The caller must be able to call this method several times without changing state.

        Returns:
        True if there is at least one event to process, false if not.
      • open

        public void open​(RawDocument input)
        Description copied from interface: IFilter
        Opens the input document described in a give RawDocument object. Skeleton information is always created when you use this method.
        Parameters:
        input - The RawDocument object to use to open the document.
      • open

        public void open​(RawDocument input,
                         boolean generateSkeleton)
        Description copied from interface: IFilter
        Opens the input document described in a give RawDocument object, and optionally creates skeleton information.
        Specified by:
        open in interface IFilter
        Overrides:
        open in class AbstractFilter
        Parameters:
        input - The RawDocument object to use to open the document.
        generateSkeleton - true to generate the skeleton data, false otherwise.
      • getFirstTextUnit

        protected ITextUnit getFirstTextUnit()
      • getFirstDocumentPart

        protected DocumentPart getFirstDocumentPart()
      • getTargetLocale

        protected LocaleId getTargetLocale()
      • next

        public Event next()
        Description copied from interface: IFilter
        Gets the next event available. Calling this method can be done only once on each event.
        Returns:
        The next event available or null if there are no events.
      • getQueueSize

        protected final int getQueueSize()
      • sendEvent

        protected final boolean sendEvent​(int index,
                                          EventType eventType,
                                          IResource res)
        Parameters:
        index -
        eventType -
        res -
      • getLineBreak

        protected final String getLineBreak()
      • addLineBreak

        protected final void addLineBreak()
      • init

        protected void init()
      • done

        protected void done()
      • processLine

        protected abstract TextProcessingResult processLine​(TextContainer lineContainer)
        Called by the filter for every line read from the input
        Parameters:
        lineContainer -
        Returns:
      • waitForLine

        protected void waitForLine​(boolean lastChance)
        Called by the filter when there are no input lines (the input has been read). Used to control implementation-specific internal buffers.
        Parameters:
        lastChance - True if there are no events in the queue, and if the method will not produce events, the filter will be finished.