Class StreamResource
java.lang.Object
org.apache.juneau.http.classic.resource.BasicResource<StreamResource>
org.apache.juneau.http.classic.resource.StreamResource
- All Implemented Interfaces:
HttpEntity,HttpResource
- Direct Known Subclasses:
StreamResource.Unmodifiable
A streamed, non-repeatable resource that obtains its content from an
InputStream.
See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor.StreamResource(HttpResponse response) Constructor.StreamResource(ContentType contentType, InputStream contents) Constructor.protectedStreamResource(StreamResource copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a builder for this class initialized with the contents of this bean.Returns an unmodifiable snapshot of this bean.Methods inherited from class org.apache.juneau.http.classic.resource.BasicResource
addHeader, addHeaders, asBytes, assertBytes, assertString, asString, consumeContent, copyFrom, freeze, getContent, getContentEncoding, getContentLength, getContentType, getEntity, getHeaders, isChunked, isRepeatable, isStreaming, isUnmodifiable, modify, self, setCached, setChunked, setChunked, setContent, setContent, setContentEncoding, setContentEncoding, setContentLength, setContentType, setContentType, setHeader, setHeaders, setHeaders, writeTo
-
Constructor Details
-
StreamResource
public StreamResource()Constructor. -
StreamResource
Constructor.- Parameters:
contentType- The entity content type. Can benull to omit an explicitContent-Type header.contents- The entity contents. Can benull , in which case aNullPointerExceptionis thrown when the resource's content is read.
-
StreamResource
Copy constructor.- Parameters:
copyFrom- The bean being copied. Must not benull .
-
StreamResource
Constructor.This is the constructor used when converting an HTTP response into a resource.
- Parameters:
response- The HTTP response to copy from. Must not benull .- Throws:
IOException- Rethrown fromHttpEntity.getContent().
-
-
Method Details
-
copy
Description copied from class:BasicResourceCreates a builder for this class initialized with the contents of this bean.Allows you to create a modifiable copy of this bean.
- Specified by:
copyin classBasicResource<StreamResource>- Returns:
- A new builder bean.
-
unmodifiable
Description copied from class:BasicResourceReturns an unmodifiable snapshot of this bean.Idempotency: if this bean is already an unmodifiable snapshot, it is returned as-is.
- Specified by:
unmodifiablein classBasicResource<StreamResource>- Returns:
- An unmodifiable snapshot of this bean, or this bean if it is already unmodifiable.
-