Class StaxStreamIO
java.lang.Object
org.apache.sis.internal.storage.xml.stream.StaxStreamIO
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
StaxStreamReader
,StaxStreamWriter
Common base class for
StaxStreamReader
and StaxStreamWriter
.
StaxStreamIO
subclasses are not used directly (they are Apache SIS internal mechanic);
they are rather used as helper classes for DataStore
implementations.
Those DataStore
s will typically manage StaxStreamReader
and StaxStreamWriter
instances on which they delegate their read and write operations.
Multi-threading
This class and subclasses are not tread-safe. Synchronization shall be done by theDataStore
that contains the StaxStreamIO
instances.- Since:
- 0.8
- Version:
- 0.8
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MarshallerPool
The (un)marshaller pool, fetched when first needed.protected final StaxDataStore
The data store for which this reader or writer has been created.(package private) AutoCloseable
The underlying stream to close when thisStaxStreamIO
reader or writer is closed, ornull
if none. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the input or output stream and releases any resources used by this XML reader or writer.protected final Errors
errors()
Returns the error resources in the current locale.(package private) final MarshallerPool
Returns the shared marshaller pool.
-
Field Details
-
owner
The data store for which this reader or writer has been created. -
stream
AutoCloseable streamThe underlying stream to close when thisStaxStreamIO
reader or writer is closed, ornull
if none. This may be the same reference thanStaxDataStore.stream
, but not necessarily if we had to create a new stream for reading the data one more time. -
jaxb
The (un)marshaller pool, fetched when first needed. The same pool is shared by allStaxStreamIO
instances created by the sameStaxDataStoreProvider
, but we nevertheless store a reference here in order to reduce the amount of synchronizations done every time we need a (un)marshaller.
-
-
Constructor Details
-
StaxStreamIO
StaxStreamIO(StaxDataStore owner) For sub-classes constructors.- Parameters:
owner
- the data store for which this reader or writer is created.
-
-
Method Details
-
getMarshallerPool
Returns the shared marshaller pool.- Throws:
JAXBException
-
close
Closes the input or output stream and releases any resources used by this XML reader or writer. This reader or writer cannot be used anymore after this method has been invoked.- Specified by:
close
in interfaceAutoCloseable
- Throws:
XMLStreamException
- if an error occurred while releasing XML reader/writer resources.IOException
- if an error occurred while closing the input or output stream.Exception
-
errors
Returns the error resources in the current locale.
-