|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LocationInfo
Interface that specifies additional access methods for accessing full location information of an input location within a stream reader. Access interface may be directly implemented by the reader, or by another (reusable or per-call-instantiated) helper object.
Note: instances of LocationInfo are only guaranteed to persist as long
as the (stream) reader points to the current element (whatever it is).
After next call to streamReader.next
, it it possible that
the previously accessed LocationInfo points to the old information, new
information, or may even contain just garbage. That is, for each new
event, getLocationInfo
should be called separately.
Method Summary | |
---|---|
XMLStreamLocation2 |
getCurrentLocation()
A method that returns the current location of the stream reader at the input source. |
long |
getEndingByteOffset()
Method that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event. |
long |
getEndingCharOffset()
Method that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right after the end of the current event. |
XMLStreamLocation2 |
getEndLocation()
An optional method that either returns the location object that points the ending position of the current event, or null if implementation does not keep track of it (some may return only start location; and some no location at all). |
javax.xml.stream.Location |
getLocation()
|
long |
getStartingByteOffset()
Method that can be used to get exact byte offset (number of bytes read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event. |
long |
getStartingCharOffset()
Method that can be used to get exact character offset (number of chars read from the stream right before getting to this location) in the stream that is pointed to by this reader, right before the start of the current event. |
XMLStreamLocation2 |
getStartLocation()
An optional method that either returns the location object that points the starting position of the current event, or null if implementation does not keep track of it (some may return only end location; and some no location at all). |
Method Detail |
---|
long getStartingByteOffset()
Note: this value MAY be the same as the one returned by
getStartingCharOffset()
, but usually only for single-byte
character streams (Ascii, ISO-Latin).
long getStartingCharOffset()
Note: this value MAY be the same as the one returned by
getStartingByteOffset()
; this is the case for single-byte
character streams (Ascii, ISO-Latin), as well as for streams for
which byte offset information is not available (Readers, Strings).
long getEndingByteOffset() throws javax.xml.stream.XMLStreamException
Note: this value MAY be the same as the one returned by
getEndingCharOffset()
, but usually only for single-byte
character streams (Ascii, ISO-Latin).
Note: for lazy-loading implementations, calling this method may require the underlying stream to be advanced and contents parsed; this is why it is possible that an exception be thrown.
javax.xml.stream.XMLStreamException
long getEndingCharOffset() throws javax.xml.stream.XMLStreamException
Note: this value MAY be the same as the one returned by
getEndingByteOffset()
; this is the case for single-byte
character streams (Ascii, ISO-Latin), as well as for streams for
which byte offset information is not available (Readers, Strings).
Note: for lazy-loading implementations, calling this method may require the underlying stream to be advanced and contents parsed; this is why it is possible that an exception be thrown.
javax.xml.stream.XMLStreamException
javax.xml.stream.Location getLocation()
XMLStreamLocation2 getStartLocation()
Note: since it is assumed that the start location must either have
been collected by now, or is not accessible (i.e. implementation
[always] returns null), no exception is allowed to be throws, as
no parsing should ever need to be done (unlike with
getEndLocation()
).
XMLStreamLocation2 getCurrentLocation()
Since this location information should always be accessible, no further parsing is to be done, and no exceptions can be thrown.
XMLStreamLocation2 getEndLocation() throws javax.xml.stream.XMLStreamException
Note: since some implementations may not yet know the end location (esp. ones that do lazy loading), this call may require further parsing. As a result, this method may throw a parsing or I/O errors.
javax.xml.stream.XMLStreamException
- If the stream reader had to advance to
the end of the event (to find the location), it may encounter a
parsing (or I/O) error; if so, that gets thrown
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |