Interface Resource

    • Method Detail

      • getLength

        long getLength()
        Returns the length of the resource's content
        Returns:
        content length
      • getInputStream

        java.io.InputStream getInputStream()
                                    throws java.io.IOException
        Returns an input stream to the content of the resource
        Returns:
        content input stream
        Throws:
        java.io.IOException - if a I/O related error occurs
      • getReader

        java.io.Reader getReader​(java.lang.String encoding)
                          throws java.io.IOException
        Returns a reader for the resource using the given character encoding
        Parameters:
        encoding - the character encoding
        Returns:
        the reader
        Throws:
        java.io.IOException - if a I/O related error occurs
      • getReader

        java.io.Reader getReader()
                          throws java.io.IOException
        Returns a reader for the resource
        Returns:
        the reader
        Throws:
        java.io.IOException - if a I/O related error occurs
      • getContent

        java.lang.String getContent​(java.lang.String encoding)
                             throws java.io.IOException
        Returns the content of the resource in a given encoding
        Parameters:
        encoding - the character encoding
        Returns:
        the content
        Throws:
        java.io.IOException - if a I/O related error occurs
      • getContent

        java.lang.String getContent()
                             throws java.io.IOException
        Returns the content of the resource
        Returns:
        the content
        Throws:
        java.io.IOException - if a I/O related error occurs
      • getBaseName

        java.lang.String getBaseName()
        Returns the short name of the resource with the file extension (everything following the last dot character) cut off.
        Returns:
        the file name without the file extension
      • getRelativePath

        java.lang.String getRelativePath()
        Get the path of this resource relative to its root repository.
        Specified by:
        getRelativePath in interface Trackable
        Returns:
        the relative resource path
      • getStripShebang

        boolean getStripShebang()
        Returns true if the input stream for this resource will look for a first line starting with the characters #! and suppress it if found
        Returns:
        true if shebang stripping is enabled
      • setStripShebang

        void setStripShebang​(boolean stripShebang)
        Switch shebang stripping on or off
        Parameters:
        stripShebang - true to enable shebang stripping
      • getLineNumber

        int getLineNumber()
        Return the current line number of this resource. Useful in combination with things like shebang stripping and shell input.
        Returns:
        the current line number of this resource