public class DefaultInputFile extends Object implements InputFile, InputFile, Serializable
InputFile.Status, InputFile.Type| Constructor and Description |
|---|
DefaultInputFile(String relativePath) |
| Modifier and Type | Method and Description |
|---|---|
String |
absolutePath()
Marked as nullable just for the unit tests that do not call
setFile(java.io.File)
previously. |
String |
deprecatedKey()
Key used before version 4.2.
|
boolean |
equals(Object o) |
File |
file()
The underlying absolute
File |
File |
getFile()
Deprecated.
in 4.2. Use
file() |
File |
getFileBaseDir()
Deprecated.
in 4.2. Replaced by
FileSystem.baseDir() |
InputStream |
getInputStream()
Get an
InputStream that reads from the file. |
String |
getRelativePath()
Deprecated.
in 4.2. Use
relativePath() |
String |
hash()
Digest hash of the file.
|
int |
hashCode() |
String |
key()
Component key.
|
String |
language()
Marked as nullable just for the unit tests that do not call
setLanguage(String)
previously. |
int |
lines()
Number of physical lines.
|
String |
pathRelativeToSourceDir()
Used only for backward-compatibility.
|
String |
relativePath()
Path relative to module base directory.
|
DefaultInputFile |
setAbsolutePath(String s) |
void |
setBasedir(File basedir) |
DefaultInputFile |
setDeprecatedKey(String s) |
DefaultInputFile |
setFile(File file) |
DefaultInputFile |
setHash(String hash) |
DefaultInputFile |
setKey(String s) |
DefaultInputFile |
setLanguage(String language) |
DefaultInputFile |
setLines(int lines) |
DefaultInputFile |
setPathRelativeToSourceDir(String s) |
DefaultInputFile |
setSourceDirAbsolutePath(String s) |
DefaultInputFile |
setStatus(InputFile.Status status) |
DefaultInputFile |
setType(InputFile.Type type) |
String |
sourceDirAbsolutePath()
Used only for backward-compatibility.
|
InputFile.Status |
status()
Marked as nullable just for the unit tests that do not previously call
setStatus(org.sonar.api.batch.fs.InputFile.Status) |
String |
toString() |
InputFile.Type |
type()
Does it contain main or test code ?
|
public DefaultInputFile(String relativePath)
public String relativePath()
InputFileFileSystem. File separator is the forward
slash ('/'), even on Microsoft Windows.
Returns src/main/java/com/Foo.java if module base dir is
/path/to/module and if file is
/path/to/module/src/main/java/com/Foo.java.
Relative path is not null and is normalized ('foo/../foo' is replaced by 'foo').@CheckForNull public String absolutePath()
setFile(java.io.File)
previously.@CheckForNull public String language()
setLanguage(String)
previously.public InputFile.Type type()
InputFile@CheckForNull public InputFile.Status status()
setStatus(org.sonar.api.batch.fs.InputFile.Status)@CheckForNull public String hash()
setHash(String)public int lines()
InputFile@CheckForNull public String key()
setKey(String).public DefaultInputFile setAbsolutePath(String s)
public DefaultInputFile setLanguage(String language)
public DefaultInputFile setFile(File file)
public DefaultInputFile setType(InputFile.Type type)
public DefaultInputFile setStatus(InputFile.Status status)
public DefaultInputFile setHash(String hash)
public DefaultInputFile setLines(int lines)
public DefaultInputFile setKey(String s)
public String deprecatedKey()
key on Java files.public DefaultInputFile setDeprecatedKey(String s)
public String sourceDirAbsolutePath()
public DefaultInputFile setSourceDirAbsolutePath(String s)
public String pathRelativeToSourceDir()
public DefaultInputFile setPathRelativeToSourceDir(String s)
@Deprecated public File getFileBaseDir()
FileSystem.baseDir()InputFileFor example in maven projects, the basedir of a source file stored in
src/main/java/org/foo/ is the directory src/main/java.
getFileBaseDir in interface InputFilepublic void setBasedir(File basedir)
@Deprecated public File getFile()
file()InputFile@Deprecated public String getRelativePath()
relativePath()InputFile'/', whatever the platform.
Example on windows: if file basedir is c:\project\src\ and file is c:\project\src\org\foo\Bar.java, then relative path
is org/foo/Bar.java
Example on unix: if file basedir is /project/src and file is /project/src/org/foo/Bar.java, then relative path
is org/foo/Bar.java as well.
getRelativePath in interface InputFilepublic InputStream getInputStream() throws FileNotFoundException
InputFileInputStream that reads from the file.
The returned stream is buffered so there is no need to use a
BufferedInputStream
getInputStream in interface InputFileFileNotFoundException - if the file is not foundCopyright © 2009-2014 SonarSource. All Rights Reserved.