Interface JsonLocation


  • public interface JsonLocation
    Provides the location information of a JSON event in an input source. The JsonLocation information can be used to identify incorrect JSON or can be used by higher frameworks to know about the processing location.

    This is a near-exact copy of the same-titled Java EE 8 Class: javax.json.stream.JsonLocation
    Commenting has been slightly modified to accompany HiLited Code Examples.
    Java Source Code remains identical to the Sun-Oracle & 'GlassFish' Released Distributions.

    Read included License: HERE, and the CDDL+GPL-1.1
    All javax.json.stream.* Code Obtained From: GitHub JavaEE jsonp  Public Archive.


    All the information provided by a JsonLocation is optional. For example, a provider may only report line numbers. Also, there may not be any location information for an input source. For example, if a JsonParser is created using JsonArray input source, all the methods in this class return -1.
    See Also:
    JsonParser, JsonParsingException


    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getColumnNumber()
      Return the column number (starts with 1 for the first column) for the current JSON event in the input source.
      long getLineNumber()
      Return the line number (starts with 1 for the first line) for the current JSON event in the input source.
      long getStreamOffset()
      Return the stream offset into the input source this location is pointing to.
    • Method Detail

      • getLineNumber

        🡇     🗕  🗗  🗖
        long getLineNumber()
        Return the line number (starts with 1 for the first line) for the current JSON event in the input source.
        Returns:
        the line number (starts with 1 for the first line) or -1 if none is available
      • getColumnNumber

        🡅  🡇     🗕  🗗  🗖
        long getColumnNumber()
        Return the column number (starts with 1 for the first column) for the current JSON event in the input source.
        Returns:
        the column number (starts with 1 for the first column) or -1 if none is available
      • getStreamOffset

        🡅     🗕  🗗  🗖
        long getStreamOffset()
        Return the stream offset into the input source this location is pointing to. If the input source is a file or a byte stream then this is the byte offset into that stream, but if the input source is a character media then the offset is the character offset. Returns -1 if there is no offset available.
        Returns:
        the offset of input source stream, or -1 if there is no offset available