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 DataStores 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 MarshallerPoolThe (un)marshaller pool, fetched when first needed.protected final StaxDataStoreThe data store for which this reader or writer has been created.(package private) AutoCloseableThe underlying stream to close when thisStaxStreamIOreader or writer is closed, ornullif none. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the input or output stream and releases any resources used by this XML reader or writer.protected final Errorserrors()Returns the error resources in the current locale.(package private) final MarshallerPoolReturns 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 thisStaxStreamIOreader or writer is closed, ornullif 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 allStaxStreamIOinstances 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:
closein 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.
-