java.lang.Object
com.tectonica.jonix.JonixSource
Represents a source (either a
File
or an InputStream
) containing ONIX records.
While iterating over records with JonixRecords
, this object is accessible via the JonixRecord.source
passed to the caller with each ONIX record. It can be used to query the details of the current source, such as its
(auto-detected) ONIX version, its ONIX Header (if provided), and of course the file/stream behind it.
Also, it provides a key-value map, that the caller can use during iteration for applicative purposes.
-
Field Summary
Modifier and TypeFieldDescriptionfinal File
final InputStream
Mandatory, non-null member, represented by this source (even it the user passed aFile
object) -
Method Summary
Modifier and TypeMethodDescriptionheader()
boolean
int
int
<T> T
<T> T
void
Call this in an event triggered by.onSourceStart()
if you wish to skip the current source and move on to the next one<T> JonixSource
Stores an object for later use during the streaming OF THIS SOURCE (as opposed to the more generalJonixRecords.store(String, Object)
which stores an object for use throughout the entire streaming).toString()
-
Field Details
-
stream
Mandatory, non-null member, represented by this source (even it the user passed aFile
object) -
file
-
-
Method Details
-
isStreamBased
public boolean isStreamBased() -
sourceName
- Returns:
- the absolute path of the file (if this source pertains to a file), or some text label representing the
stream if
isStreamBased()
.
-
header
-
onixVersion
-
onixRelease
-
productCount
public int productCount()- Returns:
- the ordinal number of the current product, counting from the beginning of this source
-
productGlobalCount
public int productGlobalCount()- Returns:
- the ordinal number of the current product, counting from the beginning of this stream
-
skipSource
public void skipSource()Call this in an event triggered by.onSourceStart()
if you wish to skip the current source and move on to the next one -
store
Stores an object for later use during the streaming OF THIS SOURCE (as opposed to the more generalJonixRecords.store(String, Object)
which stores an object for use throughout the entire streaming). The stored object can be retrieved withretrieve(String)
. -
retrieve
- Returns:
- an object stored with
store(String, Object)
during the streaming of the current source, ornull
if thekey
doesn't exist
-
retrieve
- Returns:
- an object stored with
store(String, Object)
during the streaming of the current source, ordefaultValue
if thekey
doesn't exist
-
toString
-