Class ByteArrayResource
java.lang.Object
org.apache.juneau.http.classic.resource.BasicResource<ByteArrayResource>
org.apache.juneau.http.classic.resource.ByteArrayResource
- All Implemented Interfaces:
HttpEntity,HttpResource
- Direct Known Subclasses:
ByteArrayResource.Unmodifiable
A repeatable resource that obtains its content from a byte array.
See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor.ByteArrayResource(ContentType contentType, byte[] contents) Constructor.protectedByteArrayResource(ByteArrayResource 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
-
ByteArrayResource
public ByteArrayResource()Constructor. -
ByteArrayResource
Constructor.- Parameters:
contentType- The entity content type. Can benull to omit an explicitContent-Type header.contents- The entity contents. Can benull (treated as an empty byte array).
-
ByteArrayResource
Copy constructor.- Parameters:
copyFrom- The bean being copied. Must not benull .
-
-
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<ByteArrayResource>- 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<ByteArrayResource>- Returns:
- An unmodifiable snapshot of this bean, or this bean if it is already unmodifiable.
-