Interface JdbcDriverDownloader.UrlConnectionWrapper

  • Enclosing class:
    JdbcDriverDownloader

    public static interface JdbcDriverDownloader.UrlConnectionWrapper

    A wrapper around an open connection to a (local or remote) URL.

    Since:
    2018.1
    Author:
    Andrey Shcheglov <mailto:andrey.shcheglov@jetbrains.com>
    • Method Detail

      • getResponseCode

        int getResponseCode()
                     throws IOException

        Gets the status code from an HTTP response message. Returns -1 if no code can be discerned from the response (i. e., the response is not valid HTTP).

        Returns:
        the HTTP Status-Code, or -1.
        Throws:
        IOException - if an error occurred connecting to the server.
        See Also:
        HttpURLConnection.getResponseCode()
      • getResponseMessage

        @Nullable
        String getResponseMessage()
                           throws IOException

        Gets the HTTP response message, if any, returned along with the response code from a server. Returns null if none could be discerned from the responses (the result was not valid HTTP).

        Returns:
        the HTTP response message, or null.
        Throws:
        IOException - if an error occurred connecting to the server.
        See Also:
        HttpURLConnection.getResponseMessage()
      • getContentLength

        long getContentLength()

        Returns the value of the Content-Length header field. Necessary for the correct download progress monitoring.

        Returns:
        the content length of the resource that this connection's URL references, or -1L if the content length is not known.
        See Also:
        URLConnection.getContentLength()
      • getCharset

        @NotNull
        Charset getCharset()

        Returns the charset specified in the HTTP {code Content-Type} header field, or the default charset value safe enough to handle this {code Content-Type}.

        Returns:
        the charset specified in the HTTP {code Content-Type} header field, or the default value.