public interface SentenceDataReader extends de.ims.icarus.io.Reader<SentenceData>
SentenceData
objects.
It is used to sequentially access SentenceData
from
arbitrary locations. Typically a SentenceDataReader
is not thread-safe since init(Location, Options)
could alter
the location
of the reader from another thread while
the original "owner-thread"
is still accessing data via
next()
. For this reason every entity that uses a reader
should obtain a private instance and not share it!Modifier and Type | Field and Description |
---|---|
static java.lang.String |
INCLUDE_GOLD_OPTION |
static java.lang.String |
INCLUDE_SYSTEM_OPTION |
static java.lang.String |
INCLUDE_USER_OPTION |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all underlying I/O-objects.
|
de.ims.icarus.util.data.ContentType |
getContentType() |
void |
init(de.ims.icarus.util.location.Location location,
de.ims.icarus.util.Options options)
Sets the
Location to load data from and initializes
internal state so that calls to next() will actually
start to read SentenceData objects. |
SentenceData |
next()
Returns the next
SentenceData object available or null
if the end of the "data stream" is reached. |
static final java.lang.String INCLUDE_SYSTEM_OPTION
static final java.lang.String INCLUDE_GOLD_OPTION
static final java.lang.String INCLUDE_USER_OPTION
void init(de.ims.icarus.util.location.Location location, de.ims.icarus.util.Options options) throws java.io.IOException, de.ims.icarus.util.location.UnsupportedLocationException
Location
to load data from and initializes
internal state so that calls to next()
will actually
start to read SentenceData
objects.init
in interface de.ims.icarus.io.Reader<SentenceData>
location
- the Location
to load data fromoptions
- a collection of additional info for the readerjava.io.IOException
- forwarding of encountered IOException
sde.ims.icarus.util.location.UnsupportedLocationException
- if the provided Location
is not supported or not validSentenceData next() throws java.io.IOException, de.ims.icarus.util.UnsupportedFormatException
SentenceData
object available or null
if the end of the "data stream"
is reached. IOException
s
should simply be forwarded to the calling method and in the case of
data that is unreadable
for this reader an UnsupportedFormatException
should be thrown instead of returning null
.next
in interface de.ims.icarus.io.Reader<SentenceData>
SentenceData
object available for this reader or
null
if the end of the "data stream"
is reachedjava.io.IOException
- simple forwarding of encountered IOException
sde.ims.icarus.util.UnsupportedFormatException
- if the reader could not construct
a new SentenceData
object from the loaded data.void close() throws java.io.IOException
next()
should throw IOException
.close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
close
in interface de.ims.icarus.io.Reader<SentenceData>
java.io.IOException
de.ims.icarus.util.data.ContentType getContentType()
getContentType
in interface de.ims.icarus.io.Reader<SentenceData>