org.sonar.api.resources
Interface InputFile


public interface InputFile

Since:
2.6

Method Summary
 File getFile()
          Get the underlying file.
 File getFileBaseDir()
          The source base directory, different than the project basedir.
 InputStream getInputStream()
          Get an InputStream that reads from the file.
 String getRelativePath()
          Path relative to basedir.
 

Method Detail

getFileBaseDir

File getFileBaseDir()
The source base directory, different than the project basedir.

For example in maven projects, the basedir of a source file stored in src/main/java/org/foo/ is the directory src/main/java.


getFile

File getFile()
Get the underlying file.

Returns:
the file

getRelativePath

String getRelativePath()
Path relative to basedir. Directory separator is slash '/', 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.


getInputStream

InputStream getInputStream()
                           throws FileNotFoundException
Get an InputStream that reads from the file.

The returned stream is buffered so there is no need to use a BufferedInputStream

Returns:
the stream
Throws:
FileNotFoundException - if the file is not found
Since:
3.1


Copyright © 2009-2013 SonarSource. All Rights Reserved.