Java HTTP Close close(java.net.HttpURLConnection hconn)

Here you can find the source of close(java.net.HttpURLConnection hconn)

Description

close

License

Open Source License

Declaration

public final static void close(java.net.HttpURLConnection hconn) 

Method Source Code


//package com.java2s;
import java.io.*;

public class Main {
    public final static void close(InputStream in) {
        // Close the input stream, ignoring errors.
        if (in != null)
            try {

                in.close();/*from  w  w  w.ja  v a 2s.c o  m*/
            } catch (IOException e) {
            }
    }

    public final static void close(OutputStream out) {
        // Close the output stream, ignoring errors.
        try {
            if (out != null)
                out.close();
        } catch (IOException e) {
        }
    }

    public final static void close(Writer out) {
        // Close the writer, ignoring errors.
        if (out != null)
            try {

                out.close();
            } catch (IOException e) {
            }
    }

    public final static void close(Reader in) {
        // Close the reader, ignoring errors.
        if (in != null)
            try {
                in.close();
            } catch (IOException e) {
            }
    }

    public final static void close(java.net.Socket socket) {
        // Close the socket, ignoring errors.
        if (socket != null)
            try {

                socket.close();
            } catch (IOException e) {
            }
    }

    public final static void close(java.net.ServerSocket socket) {
        // Close the socket, ignoring errors.
        if (socket != null)
            try {
                socket.close();
            } catch (IOException e) {
            }
    }

    public final static void close(java.net.HttpURLConnection hconn) {
        if (hconn != null)
            try {
                hconn.disconnect();
            } catch (Exception e) {
            }
    }
}

Related

  1. close(final URLConnection conn)
  2. close(URLConnection conn)
  3. close(URLConnection connection)
  4. closeAll(HttpURLConnection httpURLConnection, Writer writer, OutputStream outputStream)
  5. closeConnection(final HttpURLConnection connection)