Java HTTP Close close(URLConnection conn)

Here you can find the source of close(URLConnection conn)

Description

Closes a URLConnection.

License

Open Source License

Parameter

Parameter Description
conn the connection to close.

Declaration

public static void close(URLConnection conn) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.*;

public class Main {
    /**/*from  ww w.  jav a  2s .c o m*/
     * Closes a URLConnection.
     *
     * @param conn the connection to close.
     * @since 2.4
     */
    public static void close(URLConnection conn) {
        if (conn instanceof HttpURLConnection) {
            ((HttpURLConnection) conn).disconnect();
        }
    }
}

Related

  1. close(final URLConnection conn)
  2. close(java.net.HttpURLConnection hconn)
  3. close(URLConnection connection)
  4. closeAll(HttpURLConnection httpURLConnection, Writer writer, OutputStream outputStream)
  5. closeConnection(final HttpURLConnection connection)
  6. closeHttpUrlConnectionNoException(HttpURLConnection... closeables)