Package org.sonar.api.batch.fs
Interface IndexedFile
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description java.lang.String
absolutePath()
Deprecated.java.io.File
file()
Deprecated.java.lang.String
filename()
Filename for this file (inclusing extension).java.io.InputStream
inputStream()
Creates a stream of the file's contents.default boolean
isHidden()
Check if the file is hidden by the file system.java.lang.String
language()
Language, for example "java" or "php".java.nio.file.Path
path()
Deprecated.java.lang.String
relativePath()
Deprecated.InputFile.Type
type()
Does it contain main or test code ?java.net.URI
uri()
Identifier of the file.-
Methods inherited from interface org.sonar.api.batch.fs.InputComponent
isFile, key
-
-
-
-
Method Detail
-
relativePath
@Deprecated java.lang.String relativePath()
Deprecated.Path relative to module base directory. Path is unique and identifies file within given
. File separator is the forward slash ('/'), even on Microsoft Windows.FileSystem
Returnssrc/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').- Specified by:
relativePath
in interfaceInputPath
- See Also:
InputFile.relativePath()
,InputDir.relativePath()
-
absolutePath
@Deprecated java.lang.String absolutePath()
Deprecated.Normalized absolute path. File separator is forward slash ('/'), even on Microsoft Windows.
This is not canonical path. Symbolic links are not resolved. For example if /project/src links to /tmp/src and basedir is /project, then this method returns /project/src/index.php. Usefile().getCanonicalPath()
to resolve symbolic link.- Specified by:
absolutePath
in interfaceInputPath
- See Also:
InputFile.absolutePath()
,InputDir.absolutePath()
-
file
@Deprecated java.io.File file()
Deprecated.The underlying absoluteFile
. It should not be used to read the file in the filesystem.- Specified by:
file
in interfaceInputPath
- See Also:
#contents()
,inputStream()
-
path
@Deprecated java.nio.file.Path path()
Deprecated.The underlying absolutePath
. It should not be used to read the file in the filesystem.- Specified by:
path
in interfaceInputPath
- Since:
- 5.1
- See Also:
#contents()
,inputStream()
-
uri
java.net.URI uri()
Identifier of the file. The only guarantee is that it is unique in the project. You should not assume it is a file:// URI.
-
filename
java.lang.String filename()
Filename for this file (inclusing extension). For example: MyClass.java.- Since:
- 6.6
-
language
@CheckForNull java.lang.String language()
Language, for example "java" or "php". Can be null if indexation of all files is enabled and no language claims to support the file.
-
type
InputFile.Type type()
Does it contain main or test code ?
-
inputStream
java.io.InputStream inputStream() throws java.io.IOException
Creates a stream of the file's contents. Depending on the runtime context, the source might be a file in a physical or virtual filesystem. Typically, it won't be buffered. The stream must be closed by the caller.- Throws:
java.io.IOException
- Since:
- 6.2
-
isHidden
default boolean isHidden()
Check if the file is hidden by the file system. Implementations depend on the runtime context, returns false by default.- Since:
- 12.0
-
-