Source

final class Source

An input source such as a file or a text buffer.

The source may optionally contain information about start offsets of each line in which case it can entity offsets to line and column numbers. For this to work endLine should be called for each line in the order as they appear in the input.

Methods

endLine

public void endLine(int length)

Notifies the source of the line end.

getColumnNumber

public int getColumnNumber(int offset, int lineNumber)

Returns the column number for the specified offset in the input.

getLineNumber

public int getLineNumber(int offset)

Returns the line number for the specified offset in the input.

getName

public String getName()

Returns the name of this source.

getText

public String getText()

newFileSource

public static Source newFileSource(String filename)

Constructs a new source from a file.

newStringSource

public static Source newStringSource(String name, String input)

Constructs a new source from a string containing the input.

newStringSource

public static Source newStringSource(String input)

Constructs a new source from a string containing the input.