Java Utililty Methods HTTP Close

List of utility methods to do HTTP Close

Description

The list of methods to do HTTP Close are organized into topic(s).

Method

voidclose(final URLConnection conn)
close
if (conn instanceof HttpURLConnection) {
    ((HttpURLConnection) conn).disconnect();
voidclose(java.net.HttpURLConnection hconn)
close
if (hconn != null)
    try {
        hconn.disconnect();
    } catch (Exception e) {
voidclose(URLConnection conn)
Closes a URLConnection.
if (conn instanceof HttpURLConnection) {
    ((HttpURLConnection) conn).disconnect();
URLConnectionclose(URLConnection connection)
Closes a given URL connection, if necessary.
if (connection instanceof HttpURLConnection) {
    ((HttpURLConnection) connection).disconnect();
return null;
voidcloseAll(HttpURLConnection httpURLConnection, Writer writer, OutputStream outputStream)
close All
if (httpURLConnection != null) {
    httpURLConnection.disconnect();
if (outputStream != null) {
    outputStream.close();
if (writer != null) {
    writer.close();
...
voidcloseConnection(final HttpURLConnection connection)
close Connection
if (connection != null) {
    connection.disconnect();
voidcloseHttpUrlConnectionNoException(HttpURLConnection... closeables)
close Http Url Connection No Exception
if (closeables != null) {
    for (HttpURLConnection cl : closeables) {
        try {
            cl.disconnect();
        } catch (Exception ioe) {
voidcloseQuietly(HttpURLConnection connection)
Closes all streams of the connection, and disconnects it.
try {
    connection.disconnect();
} catch (Exception e) {
try {
    connection.getInputStream().close();
} catch (Exception e) {
try {
    connection.getOutputStream().close();
} catch (Exception e) {
try {
    connection.getErrorStream().close();
} catch (Exception e) {
voidcloseQuietly(HttpURLConnection connection, Reader reader)
close Quietly
if (connection != null) {
    try {
        connection.disconnect();
    } catch (Exception ignored) {
try {
    if (reader != null) {
...
voidcloseQuietly(URLConnection cnn)
close Quietly
if (cnn == null) {
    return;
} else if (cnn instanceof HttpURLConnection) {
    ((HttpURLConnection) cnn).disconnect();
} else {