Package eu.clarin.sru.server.fcs
Class AdvancedDataViewWriter
- java.lang.Object
- 
- eu.clarin.sru.server.fcs.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.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classAdvancedDataViewWriter.Unit
 - 
Field SummaryFields Modifier and Type Field Description static intNO_HIGHLIGHT
 - 
Constructor SummaryConstructors Constructor Description AdvancedDataViewWriter(AdvancedDataViewWriter.Unit unit)Constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSpan(URI layerId, long start, long end, String value)Add a span.voidaddSpan(URI layerId, long start, long end, String value, int highlight)Add a span.voidaddSpan(URI layerId, long start, long end, String value, String altValue)Add a span.voidaddSpan(URI layerId, long start, long end, String value, String altValue, int highlight)Add a span.voidreset()Reset the writer for writing a new data view (instance).voidwriteAdvancedDataView(XMLStreamWriter writer)Write the Advanced Data View to the output stream.voidwriteHitsDataView(XMLStreamWriter writer, URI layerId)Convenience method to write HITS Data View.
 
- 
- 
- 
Field Detail- 
NO_HIGHLIGHTpublic static final int NO_HIGHLIGHT - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
AdvancedDataViewWriterpublic AdvancedDataViewWriter(AdvancedDataViewWriter.Unit unit) Constructor.- Parameters:
- unit- the unit to be used for span offsets
- See Also:
- AdvancedDataViewWriter.Unit
 
 
- 
 - 
Method Detail- 
resetpublic void reset() Reset the writer for writing a new data view (instance).
 - 
addSpanpublic 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- nullif none
- Throws:
- IllegalArgumentException- if any argument is invalid
 
 - 
addSpanpublic 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- nullif none
- highlight- the highlight group
- Throws:
- IllegalArgumentException- if any argument is invalid
 
 - 
addSpanpublic 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- nullif none
- altValue- the span's alternate value or- nullif none
 
 - 
addSpanpublic 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- nullif none
- altValue- the span's alternate value or- nullif none
- highlight- the highlight group
- Throws:
- IllegalArgumentException- if any argument is invalid
 
 - 
writeAdvancedDataViewpublic 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
 
 - 
writeHitsDataViewpublic 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
 
 
- 
 
-