com.springsource.util.osgi.manifest.parse.standard
Class SourceContext
java.lang.Object
com.springsource.util.osgi.manifest.parse.standard.SourceContext
public class SourceContext
- extends java.lang.Object
SourceContext captures information about the data being processed by the
lexer and parser. This information can be used to provide more accurate
informational or error messages. Internally it has a copy of the original
source and where the linebreaks are within it.
The header parser actually doesn't benefit from this class knowing about
linebreaks because all data is on one line. But for the general Manifest
parser where data is split across multiple lines, it is very useful.
Concurrent Semantics
Threadsafe.
- Author:
- Andy Clement
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
linebreaks
private int[] linebreaks
theSource
private java.lang.String theSource
SourceContext
public SourceContext(java.lang.String theSource)
setLinebreaks
public void setLinebreaks(java.util.List<java.lang.Integer> linebreaks)
getLinebreaks
public int[] getLinebreaks()
- Returns:
- the positions in the source data where the lines start.
getLine
public int getLine(int offset)
getColumn
public int getColumn(int offset)
getRelevantStartLinebreakEntry
private int getRelevantStartLinebreakEntry(int startoffset)
getLineAsString
public java.lang.String getLineAsString(int relevantLine)