Debian Codegraph @

src/jakarta/json/stream/JsonLocation.java

raw symbols SCIP
1 /*
2 * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v. 2.0, which is available at
6 * http://www.eclipse.org/legal/epl-2.0.
7 *
8 * This Source Code may also be made available under the following Secondary
9 * Licenses when the conditions for such availability set forth in the
10 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11 * version 2 with the GNU Classpath Exception, which is available at
12 * https://www.gnu.org/software/classpath/license.html.
13 *
14 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15 */
16
17 package jakarta.json.stream;
18
19 /**
20 * Provides the location information of a JSON event in an input source. The
21 * {@code JsonLocation} information can be used to identify incorrect JSON
22 * or can be used by higher frameworks to know about the processing location.
23 *
24 * <p>All the information provided by a {@code JsonLocation} is optional. For
25 * example, a provider may only report line numbers. Also, there may not be any
26 * location information for an input source. For example, if a
27 * {@code JsonParser} is created using
28 * {@link jakarta.json.JsonArray JsonArray} input source, all the methods in
29 * this class return -1.
30 * @see JsonParser
31 * @see JsonParsingException
32 */
33 public interface JsonLocation {
34
35 /**
36 * Return the line number (starts with 1 for the first line) for the current JSON event in the input source.
37 *
38 * @return the line number (starts with 1 for the first line) or -1 if none is available
39 */
40 long getLineNumber();
41
42 /**
43 * Return the column number (starts with 1 for the first column) for the current JSON event in the input source.
44 *
45 * @return the column number (starts with 1 for the first column) or -1 if none is available
46 */
47 long getColumnNumber();
48
49 /**
50 * Return the stream offset into the input source this location
51 * is pointing to. If the input source is a file or a byte stream then
52 * this is the byte offset into that stream, but if the input source is
53 * a character media then the offset is the character offset.
54 * Returns -1 if there is no offset available.
55 *
56 * @return the offset of input source stream, or -1 if there is
57 * no offset available
58 */
59 long getStreamOffset();
60
61 }