@Contract(threading=SAFE) public class FileResource extends Resource
| Constructor and Description |
|---|
FileResource(File file) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Indicates the system no longer needs to keep this
response body and any system resources associated with
it may be reclaimed.
|
byte[] |
get()
Returns resource content as a byte array.
|
InputStream |
getInputStream()
Returns resource content as an
InputStream. |
long |
length()
Returns the length in bytes of the response body.
|
String |
toString() |
public FileResource(File file)
public byte[] get()
throws ResourceIOException
ResourcePlease note for memory efficiency some resource implementations may return a reference to the underlying byte array. The returned value should be treated as immutable.
get in class ResourceResourceIOExceptionpublic InputStream getInputStream() throws ResourceIOException
ResourceInputStream.getInputStream in class ResourceResourceIOExceptionpublic long length()
Resourcepublic void dispose()
ResourceCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.