public class DefaultFileResource extends Object implements FileResource, Serializable
Constructor and Description |
---|
DefaultFileResource(File resourceFile) |
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Deprecated.
use ByteString class instead.
|
ByteString |
getByteString()
Return the resource as a byte array's clone.
|
String |
getContentType()
Get the content content type of the resource, for example image/jpeg.
|
String |
getExtension()
Returns the normalised extension for this resource, e.g.
|
File |
getFile() |
InputStream |
getInputStream()
Create an input stream for this resource.
|
long |
getSize()
Return size of the resource in bytes.
|
String |
getUriAsString()
Returns the uri (and hence a unique identifier) for a resource as a String.
|
void |
setContentType(String contentType) |
String |
toString() |
public DefaultFileResource(File resourceFile)
public File getFile()
getFile
in interface FileResource
public String getUriAsString()
UriResource
getUriAsString
in interface UriResource
public InputStream getInputStream() throws IOException
Resource
getInputStream
in interface Resource
IOException
@Deprecated public byte[] getBytes() throws IOException
getBytes
in interface Resource
IOException
public ByteString getByteString() throws IOException
Resource
getByteString
in interface Resource
IOException
public long getSize() throws IOException
Resource
getSize
in interface Resource
IOException
public String getContentType()
Resource
getContentType
in interface Resource
public void setContentType(String contentType)
public String getExtension()
Resource
getExtension
in interface Resource
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries