author | mkos |
Sun, 30 Dec 2012 00:00:00 +0100 | |
changeset 22678 | ac1ea46be942 |
parent 12009 | 4abb694f273a |
permissions | -rw-r--r-- |
12009 | 1 |
/* |
22678
ac1ea46be942
8029237: Update copyright year to match last edit in jaxws repository for 2012
mkos
parents:
12009
diff
changeset
|
2 |
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. |
12009 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
* |
|
25 |
* THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. |
|
26 |
*/ |
|
27 |
||
28 |
package com.sun.xml.internal.fastinfoset.stax; |
|
29 |
||
30 |
import javax.xml.stream.Location; |
|
31 |
||
32 |
||
33 |
public class EventLocation implements Location{ |
|
34 |
String _systemId = null; |
|
35 |
String _publicId = null; |
|
36 |
int _column = -1; |
|
37 |
int _line = -1; |
|
38 |
int _charOffset = -1; |
|
39 |
||
40 |
EventLocation() { |
|
41 |
} |
|
42 |
||
43 |
//explicitly create a nil location |
|
44 |
public static Location getNilLocation() { |
|
45 |
return new EventLocation(); |
|
46 |
} |
|
47 |
/** |
|
48 |
* Return the line number where the current event ends, |
|
49 |
* returns -1 if none is available. |
|
50 |
* @return the current line number |
|
51 |
*/ |
|
52 |
public int getLineNumber(){ |
|
53 |
return _line; |
|
54 |
} |
|
55 |
/** |
|
56 |
* Return the column number where the current event ends, |
|
57 |
* returns -1 if none is available. |
|
58 |
* @return the current column number |
|
59 |
*/ |
|
60 |
public int getColumnNumber() { |
|
61 |
return _column; |
|
62 |
} |
|
63 |
||
64 |
/** |
|
65 |
* Return the byte or character offset into the input source this location |
|
66 |
* is pointing to. If the input source is a file or a byte stream then |
|
67 |
* this is the byte offset into that stream, but if the input source is |
|
68 |
* a character media then the offset is the character offset. |
|
69 |
* Returns -1 if there is no offset available. |
|
70 |
* @return the current offset |
|
71 |
*/ |
|
72 |
public int getCharacterOffset(){ |
|
73 |
return _charOffset; |
|
74 |
} |
|
75 |
||
76 |
/** |
|
77 |
* Returns the public ID of the XML |
|
78 |
* @return the public ID, or null if not available |
|
79 |
*/ |
|
80 |
public String getPublicId(){ |
|
81 |
return _publicId; |
|
82 |
} |
|
83 |
||
84 |
/** |
|
85 |
* Returns the system ID of the XML |
|
86 |
* @return the system ID, or null if not available |
|
87 |
*/ |
|
88 |
public String getSystemId(){ |
|
89 |
return _systemId; |
|
90 |
} |
|
91 |
||
92 |
public void setLineNumber(int line) { |
|
93 |
_line = line; |
|
94 |
} |
|
95 |
public void setColumnNumber(int col) { |
|
96 |
_column = col; |
|
97 |
} |
|
98 |
public void setCharacterOffset(int offset) { |
|
99 |
_charOffset = offset; |
|
100 |
} |
|
101 |
public void setPublicId(String id) { |
|
102 |
_publicId = id; |
|
103 |
} |
|
104 |
public void setSystemId(String id) { |
|
105 |
_systemId = id; |
|
106 |
} |
|
107 |
||
108 |
public String toString(){ |
|
109 |
StringBuffer sbuffer = new StringBuffer() ; |
|
110 |
sbuffer.append("Line number = " + _line); |
|
111 |
sbuffer.append("\n") ; |
|
112 |
sbuffer.append("Column number = " + _column); |
|
113 |
sbuffer.append("\n") ; |
|
114 |
sbuffer.append("System Id = " + _systemId); |
|
115 |
sbuffer.append("\n") ; |
|
116 |
sbuffer.append("Public Id = " + _publicId); |
|
117 |
sbuffer.append("\n") ; |
|
118 |
sbuffer.append("CharacterOffset = " + _charOffset); |
|
119 |
sbuffer.append("\n") ; |
|
120 |
return sbuffer.toString(); |
|
121 |
} |
|
122 |
||
123 |
} |