Class Http4FileObject<FS extends Http4FileSystem>

    • Field Detail

      • urlCharset

        private final java.lang.String urlCharset
        URL charset string.
      • internalURI

        private final java.net.URI internalURI
        Internal URI mapped to this FileObject. For example, the internal URI of http4://example.com/a.txt is http://example.com/a.txt.
      • lastHeadResponse

        private org.apache.http.HttpResponse lastHeadResponse
        The last executed HEAD HttpResponse object.
    • Method Detail

      • doDetach

        protected void doDetach()
                         throws java.lang.Exception
        Description copied from class: AbstractFileObject
        Detaches this file object from its file resource.

        Called when this file is closed. Note that the file object may be reused later, so should be able to be reattached.

        This implementation does nothing.

        Overrides:
        doDetach in class AbstractFileObject<FS extends Http4FileSystem>
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetInputStream

        protected java.io.InputStream doGetInputStream​(int bufferSize)
                                                throws java.lang.Exception
        Description copied from class: AbstractFileObject
        Creates an input stream to read the file content from. Is only called if AbstractFileObject.doGetType() returns FileType.FILE.

        It is guaranteed that there are no open output streams for this file when this method is called.

        The returned stream does not have to be buffered.

        Overrides:
        doGetInputStream in class AbstractFileObject<FS extends Http4FileSystem>
        Parameters:
        bufferSize - Buffer size hint.
        Returns:
        An InputStream to read the file content.
        Throws:
        java.lang.Exception - if an error occurs.
      • doGetType

        protected FileType doGetType()
                              throws java.lang.Exception
        Description copied from class: AbstractFileObject
        Determines the type of this file. Must not return null. The return value of this method is cached, so the implementation can be expensive.
        Specified by:
        doGetType in class AbstractFileObject<FS extends Http4FileSystem>
        Returns:
        the type of the file.
        Throws:
        java.lang.Exception - if an error occurs.
      • doListChildren

        protected java.lang.String[] doListChildren()
                                             throws java.lang.Exception
        Description copied from class: AbstractFileObject
        Lists the children of this file. Is only called if AbstractFileObject.doGetType() returns FileType.FOLDER. The return value of this method is cached, so the implementation can be expensive.
        Specified by:
        doListChildren in class AbstractFileObject<FS extends Http4FileSystem>
        Returns:
        a possible empty String array if the file is a directory or null or an exception if the file is not a directory or can't be read.
        Throws:
        java.lang.Exception - if an error occurs.
      • executeHttpUriRequest

        protected org.apache.http.HttpResponse executeHttpUriRequest​(org.apache.http.client.methods.HttpUriRequest httpRequest)
                                                              throws java.io.IOException
        Execute the request using the given httpRequest and return a HttpResponse from the execution.
        Parameters:
        httpRequest - HttpUriRequest object
        Returns:
        HttpResponse from the execution
        Throws:
        java.io.IOException - if IO error occurs
        Since:
        2.5.0
      • getInternalURI

        protected java.net.URI getInternalURI()
        Return the internal URI object mapped to this file object.
        Returns:
        the internal URI object mapped to this file object
      • getLastHeadResponse

        org.apache.http.HttpResponse getLastHeadResponse()
                                                  throws java.io.IOException
        Return the last executed HEAD HttpResponse object.
        Returns:
        the last executed HEAD HttpResponse object
        Throws:
        java.io.IOException - if IO error occurs
      • getUrlCharset

        protected java.lang.String getUrlCharset()
        Return URL charset string.
        Returns:
        URL charset string