Class ImageLoaderCache
This class is a trick to get the JEditorKit to load its images from the epub file instead of from the given url.
This class is installed as the JEditorPane's image cache.
Whenever it is requested an image it will try to load that image from the epub.
Can be shared by multiple documents but can only be used by one document at the time because of the currentFolder issue.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the image cache.private ImagecreateImage(Resource imageResource) Create an Image from the data of the given resource.elements()private StringgetResourceHref(String requestUrl) voidvoidinitImageLoader(HTMLDocument document) booleanisEmpty()keys()voidsetContextResource(Resource resource) intsize()toString()
-
Field Details
-
IMAGE_URL_PREFIX
- See Also:
-
log
private static final org.slf4j.Logger log -
cache
-
book
-
currentFolder
-
-
Constructor Details
-
Method Details
-
initBook
-
setContextResource
-
initImageLoader
-
getResourceHref
-
createImage
-
get
-
size
public int size()- Specified by:
sizein classDictionary<String,Image>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin classDictionary<String,Image>
-
keys
- Specified by:
keysin classDictionary<String,Image>
-
elements
- Specified by:
elementsin classDictionary<String,Image>
-
put
-
remove
-
clear
public void clear()Clears the image cache. -
toString
-