Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

XGC-82: provide a way to close the resources associated to an image w…

…ithout fully loading it

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/commons/trunk@1458373 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 269053c233ff80966adb38472faeb62a0cbd0736 1 parent e58f1dc
@vhennebert vhennebert authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/java/org/apache/xmlgraphics/image/loader/ImageManager.java
View
12 src/java/org/apache/xmlgraphics/image/loader/ImageManager.java
@@ -314,6 +314,18 @@ public Image getImage(ImageInfo info, ImageFlavor[] flavors, ImageSessionContext
}
/**
+ * Closes the resources associated to the given image. This method should be
+ * used only when none of the {@code getImage} methods is called by the
+ * client application.
+ *
+ * @param uri the URI of the image
+ * @param session the session context that was used to resolve the URI
+ */
+ public void closeImage(String uri, ImageSessionContext session) {
+ XmlSourceUtil.closeQuietly(session.getSource(uri));
+ }
+
+ /**
* Converts an image. The caller can indicate what kind of image flavors are requested. When
* this method is called the code looks for a suitable combination of ImageConverters so it
* can return the image in exactly the form the caller needs.
Please sign in to comment.
Something went wrong with that request. Please try again.