< prev index next >

src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java

Print this page

        

@@ -44,17 +44,23 @@
  * {@code addAllowedTagSet} method.  By default, the tag sets
  * {@code BaselineTIFFTagSet}, {@code FaxTIFFTagSet},
  * {@code ExifParentTIFFTagSet}, and {@code GeoTIFFTagSet}
  * are included.
  *
+ * <p> Forcing reading of fields corresponding to {@code TIFFTag}s
+ * not in any of the allowed {@code TIFFTagSet}s may be effected via
+ * {@link #setReadUnknownTags setReadUnknownTags}.
+ *
  * @since 9
  */
 public final class TIFFImageReadParam extends ImageReadParam {
 
     private final List<TIFFTagSet> allowedTagSets =
         new ArrayList<TIFFTagSet>(4);
 
+    private boolean readUnknownTags = false;
+
     /**
      * Constructs a {@code TIFFImageReadParam}.  Tags defined by
      * the {@code TIFFTagSet}s {@code BaselineTIFFTagSet},
      * {@code FaxTIFFTagSet}, {@code ExifParentTIFFTagSet}, and
      * {@code GeoTIFFTagSet} will be supported.

@@ -115,6 +121,29 @@
      * @return a {@code List} of {@code TIFFTagSet}s.
      */
     public List<TIFFTagSet> getAllowedTagSets() {
         return allowedTagSets;
     }
+
+    /**
+     * Set whether to read fields corresponding to {@code TIFFTag}s not in
+     * the allowed {@code TIFFTagSet}s. The default setting is {@code false}.
+     * If the TIFF {@code ImageReader} is ignoring metadata, then a setting
+     * of {@code true} is overridden as all metadata are ignored except those
+     * essential to reading the image itself.
+     *
+     * @param readUnknownTags Whether to read fields of unrecognized tags
+     */
+    public void setReadUnknownTags(boolean readUnknownTags) {
+        this.readUnknownTags = readUnknownTags;
+    }
+
+    /**
+     * Retrieve the setting of whether to read fields corresponding to unknown
+     * {@code TIFFTag}s.
+     *
+     * @return Whether to read fields of unrecognized tags
+     */
+    public boolean getReadUnknownTags() {
+        return readUnknownTags;
+    }
 }
< prev index next >