Class InputStreamRequestEntity
java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.InputStreamRequestEntity
- All Implemented Interfaces:
RequestEntity
A RequestEntity that contains an InputStream.
- Since:
- 3.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The content length will be calculated automatically. -
Constructor Summary
ConstructorDescriptionInputStreamRequestEntity
(InputStream content) Creates a new InputStreamRequestEntity with the given content and a content type ofCONTENT_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.InputStreamRequestEntity
(InputStream content, String contentType) Creates a new InputStreamRequestEntity with the given content, content type, and a content length ofCONTENT_LENGTH_AUTO
. -
Method Summary
Modifier and TypeMethodDescriptionlong
Gets the content length.Gets the entity's content type.boolean
Tests if this method is repeatable.void
writeRequest
(OutputStream out) Writes the request entity to the given stream.
-
Field Details
-
CONTENT_LENGTH_AUTO
public static final int CONTENT_LENGTH_AUTOThe content length will be calculated automatically. This implies buffering of the content.- See Also:
-
-
Constructor Details
-
InputStreamRequestEntity
Creates a new InputStreamRequestEntity with the given content and a content type ofCONTENT_LENGTH_AUTO
.- Parameters:
content
- The content to set.
-
InputStreamRequestEntity
Creates a new InputStreamRequestEntity with the given content, content type, and a content length ofCONTENT_LENGTH_AUTO
.- Parameters:
content
- The content to set.contentType
- The type of the content, ornull
.
-
InputStreamRequestEntity
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. IfCONTENT_LENGTH_AUTO
is given the content will be buffered in order to determine its size whengetContentLength()
is called.
-
InputStreamRequestEntity
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. IfCONTENT_LENGTH_AUTO
is given the content will be buffered in order to determine its size whengetContentLength()
is called.contentType
- The type of the content, ornull
.
-
-
Method Details
-
getContentType
Description copied from interface:RequestEntity
Gets the entity's content type. This content type will be used as the value for the "Content-Type" header.- Specified by:
getContentType
in interfaceRequestEntity
- Returns:
- the entity's content type
- See Also:
-
isRepeatable
public boolean isRepeatable()Tests if this method is repeatable. Onlytrue
if the content has been buffered.- Specified by:
isRepeatable
in interfaceRequestEntity
- Returns:
- true if the entity can be written to
OutputStream
more than once, false otherwise. - See Also:
-
writeRequest
Description copied from interface:RequestEntity
Writes the request entity to the given stream.- Specified by:
writeRequest
in interfaceRequestEntity
- Throws:
IOException
-
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.- Specified by:
getContentLength
in interfaceRequestEntity
- Returns:
- a non-negative value when content length is known or a negative value when content length is not known
-
getContent
- Returns:
- Returns the content.
-