XImageCollection

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public final class XImageCollection implements Iterable<XImage>

Class representing XImage collection.

Methods

MethodDescription
size()Count of images in collection.
isSynchronized()Returns true if object is synchronized.
getSyncRoot()Returns synchronization object.
getNames()Gets array of image names.
isReadOnly()Gets a value indicating whether the collection is read-only.
add(XImage image)Adds new image to Image list.
add(InputStream image)Adds entity to the end of the collection, so entity can be accessed by the last index.
add(BufferedImage image)Adds entity to the end of the collection, so entity can be accessed by the last index.
addWithImageFilterType(InputStream image, int filterType)Adds entity to the end of the collection, so entity can be accessed by the last index.
add(InputStream image, int quality)Adds entity to the end of the collection, so entity can be accessed by the last index.
delete(int index)Removes index from collection by index.
delete(int index, int action)Removes index from collection by index performing action specified by action parameter.
delete(String name)Removes item from collection by name.
delete(String name, int action)Removes item from collection by name.
delete()Deletes images from collection.
iterator()Returns collection enumerator.
copyTo(XImage[] array, int index)Copies array of images into collection.
replace(int index, InputStream stream)Replace image in collection with another image.
replace(int index, InputStream stream, int quality, boolean isBlackAndWhite)Replace image in collection with another image.
replace(int index, InputStream stream, int quality)Replace image in collection with another image.
get_Item(int index)Gets image from collection by its index.
get_Item(String name)Gets image from collection by its name.
hasImage(String imgName)
getImageName(XImage image)Returns name in images list which is key of the given image.
clear()Clears all items from the collection.
contains(XImage item)Determines whether the collection contains a specific value.
remove(XImage item)Not supported yet, throws exception.

size()

public int size()

Count of images in collection.

Returns: int - int value

isSynchronized()

public boolean isSynchronized()

Returns true if object is synchronized.

Returns: boolean - boolean value

getSyncRoot()

public Object getSyncRoot()

Returns synchronization object.

Returns: java.lang.Object - Object element

getNames()

public String[] getNames()

Gets array of image names.

Returns: java.lang.String[] - String[] array

isReadOnly()

public boolean isReadOnly()

Gets a value indicating whether the collection is read-only.

Returns: boolean - boolean value

add(XImage image)

public String add(XImage image)

Adds new image to Image list. This method adds image as reference to the same PdfObject (which allows to decrease file size)

Parameters:

ParameterTypeDescription
imageXImageXImage to be added.

Returns: java.lang.String - Name of the added image.

add(InputStream image)

public String add(InputStream image)

Adds entity to the end of the collection, so entity can be accessed by the last index.

Parameters:

ParameterTypeDescription
imagejava.io.InputStreamStream containing image data (in JPEG format).

Returns: java.lang.String - Name of the added image.

add(BufferedImage image)

public String add(BufferedImage image)

Adds entity to the end of the collection, so entity can be accessed by the last index.

Parameters:

ParameterTypeDescription
imagejava.awt.image.BufferedImageBufferedImage containing image data.

Returns: java.lang.String - Name of the added image.

addWithImageFilterType(InputStream image, int filterType)

public String addWithImageFilterType(InputStream image, int filterType)

Adds entity to the end of the collection, so entity can be accessed by the last index.

Parameters:

ParameterTypeDescription
imagejava.io.InputStreamStream containing image data.
filterTypeintThe image filter type.

Returns: java.lang.String - Name of the added image.

add(InputStream image, int quality)

public String add(InputStream image, int quality)

Adds entity to the end of the collection, so entity can be accessed by the last index.

Parameters:

ParameterTypeDescription
imagejava.io.InputStreamStream containing image data (in JPEG format).
qualityintJPEG quality.

Returns: java.lang.String - Name of the added image.

delete(int index)

public void delete(int index)

Removes index from collection by index.

Parameters:

ParameterTypeDescription
indexintImage index.

delete(int index, int action)

public final void delete(int index, int action)

Removes index from collection by index performing action specified by action parameter.

Parameters:

ParameterTypeDescription
indexintIndex of the image to be removed.
actionintImageDeleteAction element. Action performed after image deleting.

delete(String name)

public void delete(String name)

Removes item from collection by name.

Parameters:

ParameterTypeDescription
namejava.lang.StringName of image which must to be deleted.

delete(String name, int action)

public final void delete(String name, int action)

Removes item from collection by name.

Parameters:

ParameterTypeDescription
namejava.lang.StringName of image which must to be deleted.
actionintAction to be performed with image object.

delete()

public void delete()

Deletes images from collection.

iterator()

public Iterator<XImage> iterator()

Returns collection enumerator.

Returns: java.util.Iterator<com.aspose.pdf.XImage> - Enumerator of collection

copyTo(XImage[] array, int index)

public void copyTo(XImage[] array, int index)

Copies array of images into collection.

Parameters:

ParameterTypeDescription
arrayXImage[]Array to be copied.
indexintIndex where images will be copied into collection.

replace(int index, InputStream stream)

public void replace(int index, InputStream stream)

Replace image in collection with another image.

Parameters:

ParameterTypeDescription
indexintIndex of collection item which will be replaced.
streamjava.io.InputStreamStream containing image data (in JPEG format).

replace(int index, InputStream stream, int quality, boolean isBlackAndWhite)

public final void replace(int index, InputStream stream, int quality, boolean isBlackAndWhite)

Replace image in collection with another image.

Parameters:

ParameterTypeDescription
indexintIndex of collection item which will be replaced.
streamjava.io.InputStreamStream containing image data (in JPEG format).
qualityintQuality of JPEG compression, in percent (valid vaues are 0..100).
isBlackAndWhitebooleanIf true, image is compressed with CCITT compression method which provides better compression for black nad white image. May be used only for black and white images.

replace(int index, InputStream stream, int quality)

public void replace(int index, InputStream stream, int quality)

Replace image in collection with another image.

Parameters:

ParameterTypeDescription
indexintIndex of collection item which will be replaced.
streamjava.io.InputStreamStream containing image data (in JPEG format).
qualityintJPEG quality.

get_Item(int index)

public XImage get_Item(int index)

Gets image from collection by its index.

Parameters:

ParameterTypeDescription
indexintImage index

Returns: XImage - Retrieved image.

get_Item(String name)

public XImage get_Item(String name)

Gets image from collection by its name.

Parameters:

ParameterTypeDescription
namejava.lang.StringImage name.

Returns: XImage - Retrieved image.

hasImage(String imgName)

public boolean hasImage(String imgName)

Parameters:

ParameterTypeDescription
imgNamejava.lang.String

Returns: boolean

getImageName(XImage image)

public String getImageName(XImage image)

Returns name in images list which is key of the given image.

Parameters:

ParameterTypeDescription
imageXImageImage to search.

Returns: java.lang.String - Name (key) of the found image; null if images was not found.

clear()

public void clear()

Clears all items from the collection.

contains(XImage item)

public boolean contains(XImage item)

Determines whether the collection contains a specific value.

Parameters:

ParameterTypeDescription
itemXImageThe object to locate in the collection

Returns: boolean - true if item is found in the collection; otherwise, false.

remove(XImage item)

public boolean remove(XImage item)

Not supported yet, throws exception.

Always throws NotImplementedException

Parameters:

ParameterTypeDescription
itemXImageXImage instance Item to remove.

Returns: boolean - boolean value