public final class StorageImage

  1. Object
  2. Image
  3. EncodedImage
  4. StorageImage

ImplementsActionSource

An encoded image that stores the actual data of the encoded image in storage.

Methods

public static StorageImage create(String fileName, byte[] data, int width, int height)Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed.
public static StorageImage create(String fileName, byte[] data, int width, int height, boolean keep)Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed.
public static StorageImage create(String fileName, InputStream data, int width, int height) throws IOExceptionCreates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed.
public static StorageImage create(String fileName, int width, int height)Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed.
public static StorageImage create(String fileName, int width, int height, boolean keep)Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed.
public byte[] getImageData()Returns the byte array data backing the image allowing the image to be stored and discarded completely from RAM.

Inherited methods

Method details

create

public static StorageImage create(String fileName, byte[] data, int width, int height)
Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed. This only works reasonably well for very small files.

Parameters

fileName String
the name of the storage file
data byte[]
the data
width int
the width of the file or -1 if unknown (notice that this will improve performance)
height int
the height of the file or -1 if unknown (notice that this will improve performance)

Returns

image that will load the file seamlessly or null if the storage failed

create

public static StorageImage create(String fileName, byte[] data, int width, int height, boolean keep)
Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed. This only works reasonably well for very small files.

Parameters

fileName String
the name of the storage file
data byte[]
the data
width int
the width of the file or -1 if unknown (notice that this will improve performance)
height int
the height of the file or -1 if unknown (notice that this will improve performance)
keep boolean
if set to true keeps the file in RAM once loaded

Returns

image that will load the file seamlessly or null if the storage failed

create

public static StorageImage create(String fileName, InputStream data, int width, int height) throws IOException
Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed. This only works reasonably well for very small files.

Parameters

fileName String
the name of the storage file
data InputStream
the stream to cache
width int
the width of the file or -1 if unknown (notice that this will improve performance)
height int
the height of the file or -1 if unknown (notice that this will improve performance)

Returns

image that will load the file seamlessly

create

public static StorageImage create(String fileName, int width, int height)
Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed. This only works reasonably well for very small files.

Parameters

fileName String
the name of the storage file
width int
the width of the file or -1 if unknown (notice that this will improve performance)
height int
the height of the file or -1 if unknown (notice that this will improve performance)

Returns

image that will load the file seamlessly

create

public static StorageImage create(String fileName, int width, int height, boolean keep)
Creates an encoded image that maps to a storage file thus allowing to seamlessly cache images as needed. This only works reasonably well for very small files.

Parameters

fileName String
the name of the storage file
width int
the width of the file or -1 if unknown (notice that this will improve performance)
height int
the height of the file or -1 if unknown (notice that this will improve performance)
keep boolean
if set to true keeps the file in RAM once loaded

Returns

image that will load the file seamlessly

getImageData

public byte[] getImageData()
Returns the byte array data backing the image allowing the image to be stored and discarded completely from RAM.

Returns

byte array used to create the image, e.g. encoded PNG, JPEG etc.