org.apache.commons.httpclient.methods

Class InputStreamRequestEntity

public class InputStreamRequestEntity extends Object implements RequestEntity

A RequestEntity that contains an InputStream.

Since: 3.0

Field Summary
static intCONTENT_LENGTH_AUTO
The content length will be calculated automatically.
Constructor Summary
InputStreamRequestEntity(InputStream content)
Creates a new InputStreamRequestEntity with the given content and a content type of {@link #CONTENT_LENGTH_AUTO}.
InputStreamRequestEntity(InputStream content, String contentType)
Creates a new InputStreamRequestEntity with the given content, content type, and a content length of {@link #CONTENT_LENGTH_AUTO}.
InputStreamRequestEntity(InputStream content, long contentLength)
Creates a new InputStreamRequestEntity with the given content and content length.
InputStreamRequestEntity(InputStream content, long contentLength, String contentType)
Creates a new InputStreamRequestEntity with the given content, content length, and content type.
Method Summary
InputStreamgetContent()
longgetContentLength()
Gets the content length.
StringgetContentType()
booleanisRepeatable()
Tests if this method is repeatable.
voidwriteRequest(OutputStream out)

Field Detail

CONTENT_LENGTH_AUTO

public static final int CONTENT_LENGTH_AUTO
The content length will be calculated automatically. This implies buffering of the content.

Constructor Detail

InputStreamRequestEntity

public InputStreamRequestEntity(InputStream content)
Creates a new InputStreamRequestEntity with the given content and a content type of {@link #CONTENT_LENGTH_AUTO}.

Parameters: content The content to set.

InputStreamRequestEntity

public InputStreamRequestEntity(InputStream content, String contentType)
Creates a new InputStreamRequestEntity with the given content, content type, and a content length of {@link #CONTENT_LENGTH_AUTO}.

Parameters: content The content to set. contentType The type of the content, or null.

InputStreamRequestEntity

public InputStreamRequestEntity(InputStream content, long contentLength)
Creates a new InputStreamRequestEntity with the given content and content length.

Parameters: content The content to set. contentLength The content size in bytes or a negative number if not known. If {@link #CONTENT_LENGTH_AUTO} is given the content will be buffered in order to determine its size when {@link #getContentLength()} is called.

InputStreamRequestEntity

public InputStreamRequestEntity(InputStream content, long contentLength, String contentType)
Creates a new InputStreamRequestEntity with the given content, content length, and content type.

Parameters: content The content to set. contentLength The content size in bytes or a negative number if not known. If {@link #CONTENT_LENGTH_AUTO} is given the content will be buffered in order to determine its size when {@link #getContentLength()} is called. contentType The type of the content, or null.

Method Detail

getContent

public InputStream getContent()

Returns: Returns the content.

getContentLength

public long getContentLength()
Gets the content length. If the content length has not been set, the content will be buffered to determine the actual content length.

getContentType

public String getContentType()

isRepeatable

public boolean isRepeatable()
Tests if this method is repeatable. Only true if the content has been buffered.

See Also: getContentLength

writeRequest

public void writeRequest(OutputStream out)
Copyright (c) 1999-2005 - Apache Software Foundation