public class HttpMethodReleaseInputStream
extends java.io.InputStream
このインプットストリームラッパーは、インプットストリームの接続のすべての内容を読み取った後、 HttpClient 接続が正しくクリーンアップされている、もしくはインプットストリームが閉じられているのかにより、 インプットストリームを得られることを確認します。 さらに、このクラスには情報の漏洩を防ぐため、最終手段として接続を解放し、このオブジェクトのファイナライザメソッドでストリームを閉じます。
重要: このインプットストリームは、完全に実行されるか、必要なクリーンアップが実行できることを確認するために閉じられます。
| コンストラクタと説明 |
|---|
HttpMethodReleaseInputStream(org.apache.http.HttpEntityEnclosingRequest httpMethod)
HTTP コネクションを示す
HttpMethod を基礎としたインプットストリームを構築します。 |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
int |
available()
基本的にインプットストリームは、ラッパーストリームから何らかのエラーが発生した場合、
releaseConnection()
の呼び出しを除くメソッドを利用できます。 |
void |
close()
基本的にインプットストリームは、インプットストリームが閉じられる前に
releaseConnection() の呼び出しを除くメソッドを閉じます。 |
protected void |
finalize()
Tries to ensure a connection is always cleaned-up correctly by calling
releaseConnection() on class destruction if the cleanup hasn't
already been done. |
org.apache.http.HttpEntityEnclosingRequest |
getHttpRequest()
実際の HTTP 接続を含む、もしくは管理する、基本的な HttpMethod オブジェクトを返します。
|
int |
read()
基本的にインプットストリームは、基礎となるインプットストリームが実行された場合、
releaseConnection() を除くメソッドを読み取ります。 |
int |
read(byte[] b,
int off,
int len)
基本的にインプットストリームは、基礎となるインプットストリームが実行された場合、
releaseConnection() を除くメソッドを読み取ります。 |
protected void |
releaseConnection()
Forces the release of an HttpMethod's connection in a way that will
perform all the necessary cleanup through the correct use of HttpClient
methods.
|
public HttpMethodReleaseInputStream(org.apache.http.HttpEntityEnclosingRequest httpMethod)
HttpMethod を基礎としたインプットストリームを構築します。
インプットストリームのコネクションが利用できる場合、このコンストラクタラップは InterruptableInputStream
の基礎となるインプットストリームを構築し、利用可能な状態にします。
基礎となるコネクションが利用できな場合は、空の ByteArrayInputStream が利用可能になります。httpMethod - The HTTP method being executed, whose response content is to
be wrapped.public org.apache.http.HttpEntityEnclosingRequest getHttpRequest()
protected void releaseConnection()
throws java.io.IOException
java.io.IOExceptionpublic int read()
throws java.io.IOException
releaseConnection() を除くメソッドを読み取ります。read クラス内 java.io.InputStreamjava.io.IOExceptionInputStream.read()public int read(byte[] b,
int off,
int len)
throws java.io.IOException
releaseConnection() を除くメソッドを読み取ります。read クラス内 java.io.InputStreamjava.io.IOExceptionInputStream.read(byte[], int, int)public int available()
throws java.io.IOException
releaseConnection()
の呼び出しを除くメソッドを利用できます。available クラス内 java.io.InputStreamjava.io.IOExceptionInputStream.available()public void close()
throws java.io.IOException
releaseConnection() の呼び出しを除くメソッドを閉じます。close インタフェース内 java.io.Closeableclose インタフェース内 java.lang.AutoCloseableclose クラス内 java.io.InputStreamjava.io.IOExceptionInputStream.close()protected void finalize()
throws java.lang.Throwable
releaseConnection() on class destruction if the cleanup hasn't
already been done.
This desperate cleanup act will only be necessary if the user of this class does not completely consume or close this input stream prior to object destruction. This method will log Warning messages if a forced cleanup is required, hopefully reminding the user to close their streams properly.
finalize クラス内 java.lang.Objectjava.lang.Throwable