com.sun.pdfview

Class Cache

public class Cache extends Object

A cache of PDF pages and images.
Constructor Summary
Cache()
Creates a new instance of a Cache
Method Summary
voidaddImage(PDFPage page, ImageInfo info, BufferedImage image)
Add an image to the cache.
voidaddImage(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer)
Add an image to the cache.
voidaddPage(Integer pageNumber, PDFPage page)
Add a page to the cache.
voidaddPage(Integer pageNumber, PDFPage page, PDFParser parser)
Add a page to the cache.
BufferedImagegetImage(PDFPage page, ImageInfo info)
Get an image from the cache
PDFRenderergetImageRenderer(PDFPage page, ImageInfo info)
Get an image's renderer from the cache
PDFPagegetPage(Integer pageNumber)
Get a page from the cache
PDFParsergetPageParser(Integer pageNumber)
Get a page's parser from the cache
voidremoveImage(PDFPage page, ImageInfo info)
Remove an image and its associated renderer from the cache
voidremovePage(Integer pageNumber)
Remove a page and all its associated images, as well as its parser and renderers, from the cache

Constructor Detail

Cache

public Cache()
Creates a new instance of a Cache

Method Detail

addImage

public void addImage(PDFPage page, ImageInfo info, BufferedImage image)
Add an image to the cache. This method should be used for images which have already been completely rendered

Parameters: page page this image is associated with info the image info associated with this image image the image to add

addImage

public void addImage(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer)
Add an image to the cache. This method should be used for images which are still in the process of being rendered.

Parameters: page the page this image is associated with info the image info associated with this image image the image to add renderer the renderer which is rendering this page

addPage

public void addPage(Integer pageNumber, PDFPage page)
Add a page to the cache. This method should be used for pages which have already been completely rendered.

Parameters: pageNumber the page number of this page page the page to add

addPage

public void addPage(Integer pageNumber, PDFPage page, PDFParser parser)
Add a page to the cache. This method should be used for pages which are still in the process of being rendered.

Parameters: pageNumber the page number of this page page the page to add parser the parser which is parsing this page

getImage

public BufferedImage getImage(PDFPage page, ImageInfo info)
Get an image from the cache

Parameters: page the page the image is associated with info the image info that describes the image

Returns: the image if it is in the cache, or null if not

getImageRenderer

public PDFRenderer getImageRenderer(PDFPage page, ImageInfo info)
Get an image's renderer from the cache

Parameters: page the page this image was generated from info the image info describing the image

Returns: the renderer, or null if it is not in the cache

getPage

public PDFPage getPage(Integer pageNumber)
Get a page from the cache

Parameters: pageNumber the number of the page to get

Returns: the page, if it is in the cache, or null if not

getPageParser

public PDFParser getPageParser(Integer pageNumber)
Get a page's parser from the cache

Parameters: pageNumber the number of the page to get the parser for

Returns: the parser, or null if it is not in the cache

removeImage

public void removeImage(PDFPage page, ImageInfo info)
Remove an image and its associated renderer from the cache

Parameters: page the page the image is generated from info the image info of the image to remove

removePage

public void removePage(Integer pageNumber)
Remove a page and all its associated images, as well as its parser and renderers, from the cache

Parameters: pageNumber the number of the page to remove