jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java
changeset 42749 91fb907a8732
parent 42710 7ae63c40a6ec
equal deleted inserted replaced
42748:fca460b63839 42749:91fb907a8732
    44  * {@code addAllowedTagSet} method.  By default, the tag sets
    44  * {@code addAllowedTagSet} method.  By default, the tag sets
    45  * {@code BaselineTIFFTagSet}, {@code FaxTIFFTagSet},
    45  * {@code BaselineTIFFTagSet}, {@code FaxTIFFTagSet},
    46  * {@code ExifParentTIFFTagSet}, and {@code GeoTIFFTagSet}
    46  * {@code ExifParentTIFFTagSet}, and {@code GeoTIFFTagSet}
    47  * are included.
    47  * are included.
    48  *
    48  *
       
    49  * <p> Forcing reading of fields corresponding to {@code TIFFTag}s
       
    50  * not in any of the allowed {@code TIFFTagSet}s may be effected via
       
    51  * {@link #setReadUnknownTags setReadUnknownTags}.
       
    52  *
    49  * @since 9
    53  * @since 9
    50  */
    54  */
    51 public final class TIFFImageReadParam extends ImageReadParam {
    55 public final class TIFFImageReadParam extends ImageReadParam {
    52 
    56 
    53     private final List<TIFFTagSet> allowedTagSets =
    57     private final List<TIFFTagSet> allowedTagSets =
    54         new ArrayList<TIFFTagSet>(4);
    58         new ArrayList<TIFFTagSet>(4);
       
    59 
       
    60     private boolean readUnknownTags = false;
    55 
    61 
    56     /**
    62     /**
    57      * Constructs a {@code TIFFImageReadParam}.  Tags defined by
    63      * Constructs a {@code TIFFImageReadParam}.  Tags defined by
    58      * the {@code TIFFTagSet}s {@code BaselineTIFFTagSet},
    64      * the {@code TIFFTagSet}s {@code BaselineTIFFTagSet},
    59      * {@code FaxTIFFTagSet}, {@code ExifParentTIFFTagSet}, and
    65      * {@code FaxTIFFTagSet}, {@code ExifParentTIFFTagSet}, and
   115      * @return a {@code List} of {@code TIFFTagSet}s.
   121      * @return a {@code List} of {@code TIFFTagSet}s.
   116      */
   122      */
   117     public List<TIFFTagSet> getAllowedTagSets() {
   123     public List<TIFFTagSet> getAllowedTagSets() {
   118         return allowedTagSets;
   124         return allowedTagSets;
   119     }
   125     }
       
   126 
       
   127     /**
       
   128      * Set whether to read fields corresponding to {@code TIFFTag}s not in
       
   129      * the allowed {@code TIFFTagSet}s. The default setting is {@code false}.
       
   130      * If the TIFF {@code ImageReader} is ignoring metadata, then a setting
       
   131      * of {@code true} is overridden as all metadata are ignored except those
       
   132      * essential to reading the image itself.
       
   133      *
       
   134      * @param readUnknownTags Whether to read fields of unrecognized tags
       
   135      */
       
   136     public void setReadUnknownTags(boolean readUnknownTags) {
       
   137         this.readUnknownTags = readUnknownTags;
       
   138     }
       
   139 
       
   140     /**
       
   141      * Retrieve the setting of whether to read fields corresponding to unknown
       
   142      * {@code TIFFTag}s.
       
   143      *
       
   144      * @return Whether to read fields of unrecognized tags
       
   145      */
       
   146     public boolean getReadUnknownTags() {
       
   147         return readUnknownTags;
       
   148     }
   120 }
   149 }