public class FileImage extends AbstractImage implements UriImage, FileResource
Modifier | Constructor and Description |
---|---|
protected |
FileImage(File imageFile)
Create a FileImage from a File, this method is protected to force use
of the ImageFactory.
|
protected |
FileImage(String imagePath)
Create a FileImage from a file path, this method is protected to force use
of the ImageFactory.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Return the resource as a byte array.
|
ByteString |
getByteString()
Return the resource as a byte array's clone.
|
File |
getFile() |
InputStream |
getInputStream()
Create an input stream for this resource.
|
ResourceInfo |
getResourceInfo() |
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.
|
String |
toString() |
getContentType, getExtension, setContentType, setExtension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getContentType, getExtension
protected FileImage(String imagePath)
imagePath
- the path of a file which contains an image, e.g.
cwd-image-extension\target\test-classes\pictures\snow.jpgprotected FileImage(File imageFile)
imageFile
- the File which contains an imagepublic File getFile()
getFile
in interface FileResource
public InputStream getInputStream() throws IOException
Resource
getInputStream
in interface Resource
IOException
public long getSize() throws IOException
Resource
getSize
in interface Resource
IOException
public byte[] getBytes() throws IOException
Resource
getBytes
in interface Resource
IOException
public ByteString getByteString() throws IOException
Resource
getByteString
in interface Resource
IOException
public String getUriAsString()
UriResource
getUriAsString
in interface UriResource
public ResourceInfo getResourceInfo()
getResourceInfo
in interface UriImage
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries