|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.javascript.jscomp.SourceFile
public abstract class SourceFile
An abstract representation of a source file that provides access to language-neutral features. The source file can be loaded from various locations, such as from disk or from a preloaded string.
Nested Class Summary | |
---|---|
static interface |
SourceFile.Generator
A JavaScript source code provider. |
Method Summary | |
---|---|
void |
clearCachedSource()
|
static SourceFile |
fromCode(String fileName,
String code)
|
static SourceFile |
fromCode(String fileName,
String originalPath,
String code)
|
static SourceFile |
fromFile(File file)
|
static SourceFile |
fromFile(File file,
Charset c)
|
static SourceFile |
fromFile(String fileName)
|
static SourceFile |
fromFile(String fileName,
Charset c)
|
static SourceFile |
fromGenerator(String fileName,
SourceFile.Generator generator)
|
static SourceFile |
fromInputStream(String fileName,
InputStream s)
|
static SourceFile |
fromInputStream(String fileName,
String originalPath,
InputStream s)
|
static SourceFile |
fromReader(String fileName,
Reader r)
|
String |
getCode()
Gets all the code in this source file. |
Reader |
getCodeReader()
Gets a reader for the code in this source file. |
String |
getLine(int lineNumber)
Gets the source line for the indicated line number. |
String |
getName()
Returns a unique name for the source file. |
String |
getOriginalPath()
|
Region |
getRegion(int lineNumber)
Get a region around the indicated line number. |
void |
setOriginalPath(String originalPath)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public String getCode() throws IOException
IOException
public Reader getCodeReader() throws IOException
IOException
public String getOriginalPath()
public void setOriginalPath(String originalPath)
public void clearCachedSource()
public String getName()
public String getLine(int lineNumber)
lineNumber
- the line number, 1 being the first line of the file.
null
if it does not exist,
or if there was an IO exception.public Region getRegion(int lineNumber)
lineNumber
- the line number, 1 being the first line of the file.
null
if it does not exist,
or if there was an IO exception.public String toString()
toString
in class Object
public static SourceFile fromFile(String fileName, Charset c)
public static SourceFile fromFile(String fileName)
public static SourceFile fromFile(File file, Charset c)
public static SourceFile fromFile(File file)
public static SourceFile fromCode(String fileName, String code)
public static SourceFile fromCode(String fileName, String originalPath, String code)
public static SourceFile fromInputStream(String fileName, InputStream s) throws IOException
IOException
public static SourceFile fromInputStream(String fileName, String originalPath, InputStream s) throws IOException
IOException
public static SourceFile fromReader(String fileName, Reader r) throws IOException
IOException
public static SourceFile fromGenerator(String fileName, SourceFile.Generator generator)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |