Package com.sun.pdfview
Class Cache
java.lang.Object
com.sun.pdfview.Cache
A cache of PDF pages and images.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
the record stored for each page in the cache(package private) class
the basic information about a page or image -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map
<Integer, SoftReference> the pages in the cache, mapped by page number -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addImage
(PDFPage page, ImageInfo info, BufferedImage image) Add an image to the cache.void
addImage
(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer) Add an image to the cache.(package private) Cache.Record
addImageRecord
(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer) The internal routine to add an image to the cache and return the record that was generated.void
Add a page to the cache.void
Add a page to the cache.(package private) Cache.PageRecord
addPageRecord
(Integer pageNumber, PDFPage page, PDFParser parser) The internal routine to add a page to the cache, and return the page record which was generatedGet an image from the cache(package private) Cache.Record
getImageRecord
(PDFPage page, ImageInfo info) Get an image's record from the cachegetImageRenderer
(PDFPage page, ImageInfo info) Get an image's renderer from the cacheGet a page from the cachegetPageParser
(Integer pageNumber) Get a page's parser from the cache(package private) Cache.PageRecord
getPageRecord
(Integer pageNumber) Get a page's record from the cachevoid
removeImage
(PDFPage page, ImageInfo info) Remove an image and its associated renderer from the cache(package private) Cache.Record
removeImageRecord
(PDFPage page, ImageInfo info) Remove an image's record from the cachevoid
removePage
(Integer pageNumber) Remove a page and all its associated images, as well as its parser and renderers, from the cache(package private) Cache.PageRecord
removePageRecord
(Integer pageNumber) Remove a page's record from the cache
-
Field Details
-
pages
the pages in the cache, mapped by page number
-
-
Constructor Details
-
Cache
public Cache()Creates a new instance of a Cache
-
-
Method Details
-
addPage
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 pagepage
- the page to add
-
addPage
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 pagepage
- the page to addparser
- the parser which is parsing this page
-
addImage
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 withinfo
- the image info associated with this imageimage
- the image to add
-
addImage
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 withinfo
- the image info associated with this imageimage
- the image to addrenderer
- the renderer which is rendering this page
-
getPage
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
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
-
getImage
Get an image from the cache- Parameters:
page
- the page the image is associated withinfo
- the image info that describes the image- Returns:
- the image if it is in the cache, or null if not
-
getImageRenderer
Get an image's renderer from the cache- Parameters:
page
- the page this image was generated frominfo
- the image info describing the image- Returns:
- the renderer, or null if it is not in the cache
-
removePage
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
-
removeImage
Remove an image and its associated renderer from the cache- Parameters:
page
- the page the image is generated frominfo
- the image info of the image to remove
-
addPageRecord
The internal routine to add a page to the cache, and return the page record which was generated -
getPageRecord
Get a page's record from the cache- Returns:
- the record, or null if it's not in the cache
-
removePageRecord
Remove a page's record from the cache -
addImageRecord
Cache.Record addImageRecord(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer) The internal routine to add an image to the cache and return the record that was generated. -
getImageRecord
Get an image's record from the cache- Returns:
- the record, or null if it's not in the cache
-
removeImageRecord
Remove an image's record from the cache
-