Class ByteBufferXMLReader
- java.lang.Object
-
- org.postgresql.pljava.internal.SyntheticXMLReader
-
- org.postgresql.pljava.internal.ByteBufferXMLReader
-
- All Implemented Interfaces:
XMLReader
- Direct Known Subclasses:
VarlenaXMLRenderer
public abstract class ByteBufferXMLReader extends SyntheticXMLReader
Wrap a readableByteBuffer
as aSyntheticXMLReader
.An implementing class must provide a
buffer()
method that returns theByteBuffer
, and the method is responsible for knowing when the memory region windowed by theByteBuffer
is no longer to be accessed, and throwing an exception in that case (unless the class also overridespin()
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
Constructors Constructor Description ByteBufferXMLReader()
-
Method Summary
Modifier and Type Method Description protected 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
-
-
-
-
Method Detail
-
pin
protected abstract void pin() throws SQLException
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
protected abstract ByteBuffer buffer() throws SQLException
Return theByteBuffer
being wrapped.All uses of the buffer in this class are preceded by
pin()
and followed byunpin()
.- Throws:
SQLException
-
next
protected abstract SyntheticXMLReader.EventCarrier next(ByteBuffer buf)
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
protected SyntheticXMLReader.EventCarrier 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
public void parse(InputSource input) throws IOException, SAXException
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
-
-