mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-09 07:35:49 +00:00
8149815: Misleading TIFFField#getAsNativeNode spec about native node name "TIFFIFD"
Change the specification verbiage of TIFFField.getAsNativeNode() to reflect the actual behavior. Reviewed-by: prr
This commit is contained in:
parent
3e726f00ed
commit
08121fbd51
@ -38,9 +38,14 @@ import javax.imageio.plugins.tiff.TIFFTagSet;
|
||||
* wherein the child node is procedural rather than buffered.
|
||||
*/
|
||||
public class TIFFFieldNode extends IIOMetadataNode {
|
||||
private static boolean isIFD(TIFFField f) {
|
||||
int type = f.getType();
|
||||
return f.hasDirectory() &&
|
||||
(type == TIFFTag.TIFF_LONG || type == TIFFTag.TIFF_IFD_POINTER);
|
||||
}
|
||||
|
||||
private static String getNodeName(TIFFField f) {
|
||||
return (f.hasDirectory() || f.getData() instanceof TIFFDirectory) ?
|
||||
"TIFFIFD" : "TIFFField";
|
||||
return isIFD(f) ? "TIFFIFD" : "TIFFField";
|
||||
}
|
||||
|
||||
private boolean isIFD;
|
||||
@ -52,8 +57,7 @@ public class TIFFFieldNode extends IIOMetadataNode {
|
||||
public TIFFFieldNode(TIFFField field) {
|
||||
super(getNodeName(field));
|
||||
|
||||
isIFD = field.hasDirectory() ||
|
||||
field.getData() instanceof TIFFDirectory;
|
||||
isIFD = isIFD(field);
|
||||
|
||||
this.field = field;
|
||||
|
||||
|
||||
@ -843,10 +843,9 @@ public class TIFFField implements Cloneable {
|
||||
* Returns the {@code TIFFField} as a node named either
|
||||
* <tt>"TIFFField"</tt> or <tt>"TIFFIFD"</tt> as described in the
|
||||
* TIFF native image metadata specification. The node will be named
|
||||
* <tt>"TIFFIFD"</tt> if and only if the field's data object is an
|
||||
* instance of {@link TIFFDirectory} or equivalently
|
||||
* {@link TIFFTag#isIFDPointer getTag.isIFDPointer()} returns
|
||||
* {@code true}.
|
||||
* <tt>"TIFFIFD"</tt> if and only if {@link #hasDirectory()} returns
|
||||
* {@code true} and the field's type is either {@link TIFFTag#TIFF_LONG}
|
||||
* or {@link TIFFTag#TIFF_IFD_POINTER}.
|
||||
*
|
||||
* @return a {@code Node} named <tt>"TIFFField"</tt> or
|
||||
* <tt>"TIFFIFD"</tt>.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user