@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.
|
public FileResource(File file)
public byte[] get() throws ResourceIOException
Resource
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.
get
in class Resource
ResourceIOException
public InputStream getInputStream() throws ResourceIOException
Resource
InputStream
.getInputStream
in class Resource
ResourceIOException
public long length()
Resource
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.