Class BaseResource

    • Constructor Detail

      • BaseResource

        public BaseResource()
    • Method Detail

      • asFile

        public Optional<File> asFile()
        Description copied from interface: Resource
        Gets the resource as a File.
        Specified by:
        asFile in interface Resource
        Returns:
        A File representing the resource.
      • asURI

        public Optional<URI> asURI()
        Description copied from interface: Resource
        As uri optional.
        Specified by:
        asURI in interface Resource
        Returns:
        the optional
      • baseName

        public String baseName()
        Description copied from interface: Resource
        Gets the name (file name or directory name) of this resource.
        Specified by:
        baseName in interface Resource
        Returns:
        The name of the file or directory
      • canRead

        public boolean canRead()
        Description copied from interface: Resource
        Returns true if the resource is readable, false if not.
        Specified by:
        canRead in interface Resource
        Returns:
        True if can read from the resource
      • canWrite

        public boolean canWrite()
        Description copied from interface: Resource
        Returns true if the resource is writable, false if not.
        Specified by:
        canWrite in interface Resource
        Returns:
        True if can write to the resource
      • compressed

        public final Resource compressed()
        Description copied from interface: Resource
        Sets is compressed.
        Specified by:
        compressed in interface Resource
        Returns:
        the resource
      • createInputStream

        protected InputStream createInputStream()
                                         throws IOException
        Create input stream input stream.
        Returns:
        the input stream
        Throws:
        IOException - the io exception
      • createOutputStream

        protected OutputStream createOutputStream()
                                           throws IOException
        Create output stream output stream.
        Returns:
        the output stream
        Throws:
        IOException - the io exception
      • descriptor

        public String descriptor()
        Description copied from interface: Resource
        Descriptor string.
        Specified by:
        descriptor in interface Resource
        Returns:
        The string representation of the resource with protocol
      • getCharset

        public final Charset getCharset()
        Description copied from interface: Resource

        Gets the charset for reading and writing. The charset if not specified will be automatically determined during read.

        Specified by:
        getCharset in interface Resource
        Returns:
        The charset used for writing and default when reading
      • isCompressed

        public final boolean isCompressed()
        Description copied from interface: Resource
        Is compressed.
        Specified by:
        isCompressed in interface Resource
        Returns:
        True if the resources is gzipped compressed
      • isDirectory

        public boolean isDirectory()
        Description copied from interface: Resource
        Is directory.
        Specified by:
        isDirectory in interface Resource
        Returns:
        True if the resource is a directory
      • path

        public String path()
        Description copied from interface: Resource
        Gets path in the same mannar as File.getPath()
        Specified by:
        path in interface Resource
        Returns:
        The full path to the resource including name
      • setCharset

        public final Resource setCharset​(Charset charset)
        Description copied from interface: Resource

        Sets the charset for reading and writing.

        Specified by:
        setCharset in interface Resource
        Parameters:
        charset - The charset to use
        Returns:
        the charset
      • setCompression

        public Resource setCompression​(Compression compression)
        Description copied from interface: Resource
        Sets the compression algorithm.
        Specified by:
        setCompression in interface Resource
        Parameters:
        compression - the compression algorithm
        Returns:
        this Resource
      • setIsCompressed

        public final Resource setIsCompressed​(boolean isCompressed)
        Description copied from interface: Resource
        Sets is compressed.
        Specified by:
        setIsCompressed in interface Resource
        Parameters:
        isCompressed - the is compressed
        Returns:
        the is compressed
      • uncompressed

        public final Resource uncompressed()
        Description copied from interface: Resource
        Uncompressed resource.
        Specified by:
        uncompressed in interface Resource
        Returns:
        the resource