@Contract(threading=SAFE) public abstract class Resource extends Object implements Serializable
Implementations of this interface are expected to be threading-safe.
| Constructor and Description |
|---|
Resource() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
dispose()
Indicates the system no longer needs to keep this
response body and any system resources associated with
it may be reclaimed.
|
abstract byte[] |
get()
Returns resource content as a byte array.
|
InputStream |
getInputStream()
Returns resource content as a
InputStream. |
abstract long |
length()
Returns the length in bytes of the response body.
|
public InputStream getInputStream() throws ResourceIOException
InputStream.ResourceIOExceptionpublic abstract byte[] get()
throws ResourceIOException
Please note for memory efficiency some resource implementations may return a reference to the underlying byte array. The returned value should be treated as immutable.
ResourceIOExceptionpublic abstract long length()
public abstract void dispose()
Copyright © 1999–2022 The Apache Software Foundation. All rights reserved.