Class DefaultIndexedFile

    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultIndexedFile​(java.lang.String projectKey, java.nio.file.Path baseDir, java.lang.String relativePath, java.lang.String language)
      Testing purposes only!
      DefaultIndexedFile​(java.nio.file.Path absolutePath, java.lang.String projectKey, java.lang.String projectRelativePath, java.lang.String moduleRelativePath, InputFile.Type type, java.lang.String language, int batchId, SensorStrategy sensorStrategy)  
    • Constructor Detail

      • DefaultIndexedFile

        public DefaultIndexedFile​(java.lang.String projectKey,
                                  java.nio.file.Path baseDir,
                                  java.lang.String relativePath,
                                  @Nullable
                                  java.lang.String language)
        Testing purposes only!
      • DefaultIndexedFile

        public DefaultIndexedFile​(java.nio.file.Path absolutePath,
                                  java.lang.String projectKey,
                                  java.lang.String projectRelativePath,
                                  java.lang.String moduleRelativePath,
                                  InputFile.Type type,
                                  @Nullable
                                  java.lang.String language,
                                  int batchId,
                                  SensorStrategy sensorStrategy)
    • Method Detail

      • relativePath

        public java.lang.String relativePath()
        Description copied from interface: IndexedFile
        Path relative to module base directory. Path is unique and identifies file within given FileSystem. 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').
        Specified by:
        relativePath in interface IndexedFile
        Specified by:
        relativePath in interface InputPath
        See Also:
        InputFile.relativePath(), InputDir.relativePath()
      • getModuleRelativePath

        public java.lang.String getModuleRelativePath()
      • getProjectRelativePath

        public java.lang.String getProjectRelativePath()
      • absolutePath

        public java.lang.String absolutePath()
        Description copied from interface: IndexedFile
        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. Use file().getCanonicalPath() to resolve symbolic link.
        Specified by:
        absolutePath in interface IndexedFile
        Specified by:
        absolutePath in interface InputPath
        See Also:
        InputFile.absolutePath(), InputDir.absolutePath()
      • inputStream

        public java.io.InputStream inputStream()
                                        throws java.io.IOException
        Description copied from interface: IndexedFile
        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.
        Specified by:
        inputStream in interface IndexedFile
        Throws:
        java.io.IOException
      • language

        @CheckForNull
        public java.lang.String language()
        Description copied from interface: IndexedFile
        Language, for example "java" or "php". Can be null if indexation of all files is enabled and no language claims to support the file.
        Specified by:
        language in interface IndexedFile
      • key

        public java.lang.String key()
        Component key (without branch).
        Specified by:
        key in interface InputComponent
      • filename

        public java.lang.String filename()
        Description copied from interface: IndexedFile
        Filename for this file (inclusing extension). For example: MyClass.java.
        Specified by:
        filename in interface IndexedFile
      • uri

        public java.net.URI uri()
        Description copied from interface: IndexedFile
        Identifier of the file. The only guarantee is that it is unique in the project. You should not assume it is a file:// URI.
        Specified by:
        uri in interface IndexedFile
        Specified by:
        uri in interface InputPath