Class AdvancedDataViewWriter


  • public class AdvancedDataViewWriter
    extends Object
    Helper class for serializing Advanced Data Views. It can be used for writing more than once, but it is not thread-save. This helper can also serialize HITS Data Views.
    • Method Detail

      • reset

        public void reset()
        Reset the writer for writing a new data view (instance).
      • addSpan

        public void addSpan​(URI layerId,
                            long start,
                            long end,
                            String value)
        Add a span.
        Parameters:
        layerId - the span's layer id
        start - the span's start offset
        end - the span's end offset
        value - the span's content value or null if none
        Throws:
        IllegalArgumentException - if any argument is invalid
      • addSpan

        public void addSpan​(URI layerId,
                            long start,
                            long end,
                            String value,
                            int highlight)
        Add a span.
        Parameters:
        layerId - the span's layer id
        start - the span's start offset
        end - the span's end offset
        value - the span's content value or null if none
        highlight - the highlight group
        Throws:
        IllegalArgumentException - if any argument is invalid
      • addSpan

        public void addSpan​(URI layerId,
                            long start,
                            long end,
                            String value,
                            String altValue)
        Add a span.
        Parameters:
        layerId - the span's layer id
        start - the span's start offset
        end - the span's end offset
        value - the span's content value or null if none
        altValue - the span's alternate value or null if none
      • addSpan

        public void addSpan​(URI layerId,
                            long start,
                            long end,
                            String value,
                            String altValue,
                            int highlight)
        Add a span.
        Parameters:
        layerId - the span's layer id
        start - the span's start offset
        end - the span's end offset
        value - the span's content value or null if none
        altValue - the span's alternate value or null if none
        highlight - the highlight group
        Throws:
        IllegalArgumentException - if any argument is invalid
      • writeAdvancedDataView

        public void writeAdvancedDataView​(XMLStreamWriter writer)
                                   throws XMLStreamException
        Write the Advanced Data View to the output stream.
        Parameters:
        writer - the writer to write to
        Throws:
        XMLStreamException - if an error occurred
      • writeHitsDataView

        public void writeHitsDataView​(XMLStreamWriter writer,
                                      URI layerId)
                               throws XMLStreamException
        Convenience method to write HITS Data View.
        Parameters:
        writer - the writer to write to
        layerId - the layer id of the layer to be serialized as HITS Data View
        Throws:
        XMLStreamException - if an error occurred
        IllegalArgumentException - if an invalid layer id was provided