|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.util.DiagnosticSource
public class DiagnosticSource
A simple abstraction of a source file, as needed for use in a diagnostic message. Provides access to the line and position in a line for any given character offset.
This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Field Summary | |
|---|---|
protected char[] |
buf
A temporary hard reference to the content of the file object. |
protected int |
bufLen
The length of the content. |
protected java.util.Map<JCTree,java.lang.Integer> |
endPosTable
|
protected JavaFileObject |
fileObject
The underlying file object. |
protected int |
line
The line number of a line found by findLine. |
protected int |
lineStart
The start of a line found by findLine. |
protected AbstractLog |
log
A log for reporting errors, such as errors accessing the content. |
protected java.lang.ref.SoftReference<char[]> |
refBuf
A soft reference to the content of the file object. |
| Constructor Summary | |
|---|---|
DiagnosticSource(JavaFileObject fo,
AbstractLog log)
|
|
| Method Summary | |
|---|---|
private boolean |
findLine(int pos)
Find the line in the buffer that contains the current position |
int |
getColumnNumber(int pos,
boolean expandTabs)
Return the one-based column number associated with a given pos for the current source file. |
java.util.Map<JCTree,java.lang.Integer> |
getEndPosTable()
|
JavaFileObject |
getFile()
Return the underlying file object handled by this DiagnosticSource object. |
java.lang.String |
getLine(int pos)
Return the content of the line containing a given pos. |
int |
getLineNumber(int pos)
Return the one-based line number associated with a given pos for the current source file. |
java.lang.CharSequence |
getName()
|
protected char[] |
initBuf(JavaFileObject fileObject)
|
void |
setEndPosTable(java.util.Map<JCTree,java.lang.Integer> t)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected JavaFileObject fileObject
protected java.util.Map<JCTree,java.lang.Integer> endPosTable
protected java.lang.ref.SoftReference<char[]> refBuf
protected char[] buf
protected int bufLen
protected int lineStart
protected int line
protected AbstractLog log
| Constructor Detail |
|---|
public DiagnosticSource(JavaFileObject fo,
AbstractLog log)
| Method Detail |
|---|
public JavaFileObject getFile()
public java.lang.CharSequence getName()
public int getLineNumber(int pos)
public int getColumnNumber(int pos,
boolean expandTabs)
public java.lang.String getLine(int pos)
public java.util.Map<JCTree,java.lang.Integer> getEndPosTable()
public void setEndPosTable(java.util.Map<JCTree,java.lang.Integer> t)
private boolean findLine(int pos)
pos - Character offset into the buffer
protected char[] initBuf(JavaFileObject fileObject)
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||