Top Description Fields Constructors Methods
org.apache.http.impl.execchain

pack-priv Class ResponseEntityProxy

extends HttpEntityWrapper
implements EofSensorWatcher
Class Inheritance
All Implemented Interfaces
org.apache.http.conn.EofSensorWatcher
Imports
java.io.IOException, .InputStream, .OutputStream, java.net.SocketException, org.apache.http.HttpEntity, .HttpResponse, org.apache.http.conn.EofSensorInputStream, .EofSensorWatcher, org.apache.http.entity.HttpEntityWrapper

A wrapper class for HttpEntity enclosed in a response message.
Since
4.3

Field Summary

Modifier and TypeField and Description
private final ConnectionHolder
Inherited from org.apache.http.entity.HttpEntityWrapper:
wrappedEntity

Constructor Summary

AccessConstructor and Description
pack-priv
ResponseEntityProxy(final HttpEntity entity, final ConnectionHolder connHolder)

Method Summary

Modifier and TypeMethod and Description
private void
private void
public void
public static void
enchance(final HttpResponse response, final ConnectionHolder connHolder)

public boolean
eofDetected(final InputStream
the underlying stream which has reached EOF
wrapped
)

Implements org.apache.http.conn.EofSensorWatcher.eofDetected.

Indicates that EOF is detected.
public InputStream
getContent()

Overrides org.apache.http.entity.HttpEntityWrapper.getContent.

Implements org.apache.http.HttpEntity.getContent.

Returns a content stream of the entity.
public boolean
isRepeatable()

Overrides org.apache.http.entity.HttpEntityWrapper.isRepeatable.

Implements org.apache.http.HttpEntity.isRepeatable.

Tells if the entity is capable of producing its data more than once.
public void
public boolean
streamAbort(final InputStream
the underlying stream which has not reached EOF
wrapped
)

Implements org.apache.http.conn.EofSensorWatcher.streamAbort.

Indicates that the stream is aborted.
public boolean
streamClosed(final InputStream
the underlying stream which has not reached EOF
wrapped
)

Implements org.apache.http.conn.EofSensorWatcher.streamClosed.

Indicates that the stream is closed.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
writeTo(final OutputStream
the output stream to write entity content to
outStream
)

Overrides org.apache.http.entity.HttpEntityWrapper.writeTo.

Implements org.apache.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.
Inherited from org.apache.http.entity.HttpEntityWrapper:
getContentEncodinggetContentLengthgetContentTypeisChunkedisStreaming

Field Detail

connHolderback to summary
private final ConnectionHolder connHolder

Constructor Detail

ResponseEntityProxyback to summary
pack-priv ResponseEntityProxy(final HttpEntity entity, final ConnectionHolder connHolder)

Method Detail

abortConnectionback to summary
private void abortConnection()
cleanupback to summary
private void cleanup() throws IOException
consumeContentback to summary
public void consumeContent() throws IOException

Overrides org.apache.http.entity.HttpEntityWrapper.consumeContent.

Implements org.apache.http.HttpEntity.consumeContent.

Doc from org.apache.http.HttpEntity.consumeContent.

This method is deprecated since version 4.1. Please use standard java convention to ensure resource deallocation by calling InputStream#close() on the input stream returned by getContent()

This method is called to indicate that the content of this entity is no longer required. All entity implementations are expected to release all allocated resources as a result of this method invocation. Content streaming entities are also expected to dispose of the remaining content, if any. Wrapping entities should delegate this call to the wrapped entity.

This method is of particular importance for entities being received from a connection. The entity needs to be consumed completely in order to re-use the connection with keep-alive.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
enchanceback to summary
public static void enchance(final HttpResponse response, final ConnectionHolder connHolder)
eofDetectedback to summary
public boolean eofDetected(final InputStream wrapped) throws IOException

Implements org.apache.http.conn.EofSensorWatcher.eofDetected.

Doc from org.apache.http.conn.EofSensorWatcher.eofDetected.

Indicates that EOF is detected.

Parameters
wrapped:InputStream

the underlying stream which has reached EOF

Returns:boolean

true if wrapped should be closed, false if it should be left alone

Annotations
@Override
Exceptions
IOException:
in case of an IO problem, for example if the watcher itself closes the underlying stream. The caller will leave the wrapped stream alone, as if false was returned.
getContentback to summary
public InputStream getContent() throws IOException

Overrides org.apache.http.entity.HttpEntityWrapper.getContent.

Implements org.apache.http.HttpEntity.getContent.

Doc from org.apache.http.HttpEntity.getContent.

Returns a content stream of the entity. Repeatable entities are expected to create a new instance of InputStream for each invocation of this method and therefore can be consumed multiple times. Entities that are not repeatable are expected to return the same InputStream instance and therefore may not be consumed more than once.

Important Note

Please note all entity implementations must ensure that all allocated resources are properly deallocated after the InputStream#close() method is invoked.

Returns:InputStream

content stream of the entity.

Annotations
@Override
Exceptions
IOException:
if the stream could not be created
isRepeatableback to summary
public boolean isRepeatable()

Overrides org.apache.http.entity.HttpEntityWrapper.isRepeatable.

Implements org.apache.http.HttpEntity.isRepeatable.

Doc from org.apache.http.HttpEntity.isRepeatable.

Tells if the entity is capable of producing its data more than once. A repeatable entity's getContent() and writeTo(OutputStream) methods can be called more than once whereas a non-repeatable entity's can not.

Returns:boolean

true if the entity is repeatable, false otherwise.

Annotations
@Override
releaseConnectionback to summary
public void releaseConnection()
streamAbortback to summary
public boolean streamAbort(final InputStream wrapped) throws IOException

Implements org.apache.http.conn.EofSensorWatcher.streamAbort.

Doc from org.apache.http.conn.EofSensorWatcher.streamAbort.

Indicates that the stream is aborted. This method will be called only if EOF was not detected before aborting. Otherwise, eofDetected is called.

This method will also be invoked when an input operation causes an IOException to be thrown to make sure the input stream gets shut down.

Parameters
wrapped:InputStream

the underlying stream which has not reached EOF

Returns:boolean

true if wrapped should be closed, false if it should be left alone

Annotations
@Override
Exceptions
IOException:
in case of an IO problem, for example if the watcher itself closes the underlying stream. The caller will leave the wrapped stream alone, as if false was returned.
streamClosedback to summary
public boolean streamClosed(final InputStream wrapped) throws IOException

Implements org.apache.http.conn.EofSensorWatcher.streamClosed.

Doc from org.apache.http.conn.EofSensorWatcher.streamClosed.

Indicates that the stream is closed. This method will be called only if EOF was not detected before closing. Otherwise, eofDetected is called.

Parameters
wrapped:InputStream

the underlying stream which has not reached EOF

Returns:boolean

true if wrapped should be closed, false if it should be left alone

Annotations
@Override
Exceptions
IOException:
in case of an IO problem, for example if the watcher itself closes the underlying stream. The caller will leave the wrapped stream alone, as if false was returned.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeToback to summary
public void writeTo(final OutputStream outStream) throws IOException

Overrides org.apache.http.entity.HttpEntityWrapper.writeTo.

Implements org.apache.http.HttpEntity.writeTo.

Doc from org.apache.http.HttpEntity.writeTo.

Writes the entity content out to the output stream.

Important Note

Please note all entity implementations must ensure that all allocated resources are properly deallocated when this method returns.

Parameters
outStream:OutputStream

the output stream to write entity content to

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs