java.lang.Object
com.tectonica.jonix.Jonix
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Creates a comma-delimited file named OUTPUT, listing all the ONIX records found in either: any file in or below DIRECTORY (default is current) whose name matches PATTERN (default is *.xml) the single file INPUTstatic JonixRecords
Initializes aJonixRecords
from an ONIXFile
.static JonixRecords
Initializes aJonixRecords
from a group of ONIXFile
s, created by scanning folder.static JonixRecords
source
(InputStream inputStream) Initializes aJonixRecords
from anInputStream
of an ONIX source.static JonixRecords
Initializes aJonixRecords
from a group of ONIXFile
s.static BaseHeader
toBaseHeader
(OnixHeader onixHeader) static BaseProduct
toBaseProduct
(OnixProduct onixProduct) static BaseProduct
toBaseProduct
(JonixRecord jonixRecord) static BaseRecord
toBaseRecord
(JonixRecord jonixRecord) static Header
toHeader2
(OnixHeader onixHeader) Convenience method to assist in casting a <Header> object (e.g.static Header
toHeader3
(OnixHeader onixHeader) Convenience method to assist in casting a <Header> object (e.g.static Product
toProduct2
(OnixProduct onixProduct) Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-2 class (i.eProduct
)static Product
toProduct2
(JonixRecord jonixRecord) Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-2 class (i.eProduct
)static Product
toProduct3
(OnixProduct onixProduct) Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-3 class (i.eProduct
)static Product
toProduct3
(JonixRecord jonixRecord) Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-3 class (i.eProduct
)
-
Constructor Details
-
Jonix
public Jonix()
-
-
Method Details
-
source
Initializes aJonixRecords
from anInputStream
of an ONIX source. This source is expected to contain valid XML content, conforming to either of the ONIX standards (the deprecated Onix2 or the current Onix3). The resultingJonixRecords
can be used to iterate over the ONIX records contained in the source.NOTE: only one
InputStream
is allowed in aJonixRecords
. It is possible, however, to add files as additional ONIX sources before starting iteration.- Parameters:
inputStream
- non-nullInputStream
with ONIX content- Returns:
- a
JonixRecords
for iterating over the ONIX content
-
source
Initializes aJonixRecords
from an ONIXFile
. This file is expected to contain valid XML content, conforming to either of the ONIX standards (the deprecated Onix2 or the current Onix3). The resultingJonixRecords
can be used to iterate over the ONIX records contained in the file.If needed, before starting iteration, more files can be added as sources, using the various
source()
methods ofJonixRecords
.- Parameters:
file
- non-nullFile
containing ONIX content- Returns:
- a
JonixRecords
for iterating over the ONIX content
-
source
Initializes aJonixRecords
from a group of ONIXFile
s. Each of these files is expected to contain valid XML content, conforming to either of the ONIX standards (the deprecated Onix2 or the current Onix3). The resultingJonixRecords
can be used to iterate over the ONIX records contained in these files.If needed, before starting iteration, more files can be added as sources, using the various
source()
methods ofJonixRecords
.- Parameters:
files
- non-null list ofFile
s containing ONIX content- Returns:
- a
JonixRecords
for iterating over the ONIX content
-
source
Initializes aJonixRecords
from a group of ONIXFile
s, created by scanning folder. Each of these files is expected to contain valid XML content, conforming to either of the ONIX standards (the deprecated Onix2 or the current Onix3). The resultingJonixRecords
can be used to iterate over the ONIX records contained in these files.If needed, before starting iteration, more files can be added as sources, using the various
source()
methods ofJonixRecords
.- Parameters:
folder
- the parent folder in which to look for ONIX filesglob
- a glob expression for determining which files within the folder is relevantrecursive
- whether or not to scan the sub-folders in the parent folder recursively- Returns:
- a
JonixRecords
for iterating over the ONIX content
-
toProduct2
Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-2 class (i.eProduct
)- Parameters:
onixProduct
- concreteOnixProduct
object, which requires casting for further processing- Returns:
- ONIX-2 type-casted object
-
toProduct2
Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-2 class (i.eProduct
)- Parameters:
jonixRecord
- aJonixRecord
holding a concreteOnixProduct
object, which requires casting for further processing- Returns:
- ONIX-2 type-casted object
-
toProduct3
Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-3 class (i.eProduct
)- Parameters:
onixProduct
- concreteOnixProduct
object, which requires casting for further processing- Returns:
- ONIX-3 type-casted object
-
toProduct3
Convenience method to assist in casting a <Product> object (as returned in aJonixRecords
stream
) into an ONIX-3 class (i.eProduct
)- Parameters:
jonixRecord
- aJonixRecord
holding a concreteOnixProduct
object, which requires casting for further processing- Returns:
- ONIX-3 type-casted object
-
toHeader2
Convenience method to assist in casting a <Header> object (e.g. as passed inJonixRecords.onSourceStart(JonixRecords.OnSourceEvent)
) into an ONIX-2 class (i.eHeader
)- Parameters:
onixHeader
- concreteOnixHeader
object, which requires casting for further processing- Returns:
- ONIX-2 type-casted object
-
toHeader3
Convenience method to assist in casting a <Header> object (e.g. as passed inJonixRecords.onSourceStart(JonixRecords.OnSourceEvent)
) into an ONIX-3 class (i.eHeader
)- Parameters:
onixHeader
- concreteOnixHeader
object, which requires casting for further processing- Returns:
- ONIX-3 type-casted object
-
toBaseRecord
-
toBaseProduct
-
toBaseProduct
-
toBaseHeader
-
main
Creates a comma-delimited file named OUTPUT, listing all the ONIX records found in either:- any file in or below DIRECTORY (default is current) whose name matches PATTERN (default is *.xml)
- the single file INPUT
- Parameters:
args
- OUTPUT INPUT or OUTPUT [DIRECTORY] [PATTERN]
-