Class ByteBufferXMLReader
- All Implemented Interfaces:
XMLReader
- Direct Known Subclasses:
VarlenaXMLRenderer
ByteBuffer
as a SyntheticXMLReader
.
An implementing class must provide a buffer()
method that returns the
ByteBuffer
, and the method is responsible for knowing when the memory
region windowed by the ByteBuffer
is no longer to be accessed, and
throwing an exception in that case (unless the class also overrides
pin()
and performs the check there instead).
The underlying buffer's position
may be used to
maintain the XML reader's position.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.postgresql.pljava.internal.SyntheticXMLReader
SyntheticXMLReader.ApacheFeature, SyntheticXMLReader.EmptyAttributes2, SyntheticXMLReader.EventCarrier, SyntheticXMLReader.FluentAttributes2, SyntheticXMLReader.SAX2FEATURE, SyntheticXMLReader.SAX2PROPERTY
-
Field Summary
Fields inherited from class org.postgresql.pljava.internal.SyntheticXMLReader
m_attributes, NO_ATTRIBUTES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ByteBuffer
buffer()
Return theByteBuffer
being wrapped.protected SyntheticXMLReader.EventCarrier
next()
This implementation invokesnext(ByteBuffer)
to get some more events.protected abstract SyntheticXMLReader.EventCarrier
next
(ByteBuffer buf) Return null if no more events available, or anEventCarrier
that carries one or more.void
parse
(InputSource input) The onlyparse
variant that the implementing class needs to supply.protected abstract void
pin()
Pin resources as needed during a reading operation.protected abstract void
unpin()
Unpin resources after a reading operation.Methods inherited from class org.postgresql.pljava.internal.SyntheticXMLReader
exceptionCarrier, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getProperty, parse, parse, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty, sourceToReader, sysIdToInputStream, sysIdToReader
-
Constructor Details
-
ByteBufferXMLReader
public ByteBufferXMLReader()
-
-
Method Details
-
pin
Pin resources as needed during a reading operation.The implementation is also responsible for tracking whether this instance has been closed, and throwing an exception if so.
- Throws:
SQLException
-
unpin
protected abstract void unpin()Unpin resources after a reading operation. -
buffer
Return theByteBuffer
being wrapped.All uses of the buffer in this class are preceded by
pin()
and followed byunpin()
.- Throws:
SQLException
-
next
Return null if no more events available, or anEventCarrier
that carries one or more.Start- and end-document events are supplied by the caller, and so should not be supplied here.
The pin on the underlying state is held.
- Parameters:
buf
- The buffer to read from. Itsposition
may be used to maintain input position.- Returns:
- An
SyntheticXMLReader.EventCarrier
representing some XML parse events, null if none remain.
-
next
This implementation invokesnext(ByteBuffer)
to get some more events.- Specified by:
next
in classSyntheticXMLReader
- Returns:
- an
SyntheticXMLReader.EventCarrier
, or null if no more.
-
parse
Description copied from class:SyntheticXMLReader
The onlyparse
variant that the implementing class needs to supply.An implementation could do as little as ignoring its
InputSource
argument and calling the zero-argumentsuper.parse()
.- Specified by:
parse
in interfaceXMLReader
- Specified by:
parse
in classSyntheticXMLReader
- Throws:
IOException
SAXException
-