826 return new long[count][2]; 827 case TIFFTag.TIFF_SSHORT: 828 return new short[count]; 829 case TIFFTag.TIFF_SLONG: 830 return new int[count]; 831 case TIFFTag.TIFF_SRATIONAL: 832 return new int[count][2]; 833 case TIFFTag.TIFF_FLOAT: 834 return new float[count]; 835 case TIFFTag.TIFF_DOUBLE: 836 return new double[count]; 837 default: 838 throw new IllegalArgumentException("Unknown data type "+dataType); 839 } 840 } 841 842 /** 843 * Returns the {@code TIFFField} as a node named either 844 * <tt>"TIFFField"</tt> or <tt>"TIFFIFD"</tt> as described in the 845 * TIFF native image metadata specification. The node will be named 846 * <tt>"TIFFIFD"</tt> if and only if the field's data object is an 847 * instance of {@link TIFFDirectory} or equivalently 848 * {@link TIFFTag#isIFDPointer getTag.isIFDPointer()} returns 849 * {@code true}. 850 * 851 * @return a {@code Node} named <tt>"TIFFField"</tt> or 852 * <tt>"TIFFIFD"</tt>. 853 */ 854 public Node getAsNativeNode() { 855 return new TIFFFieldNode(this); 856 } 857 858 /** 859 * Indicates whether the value associated with the field is of 860 * integral data type. 861 * 862 * @return Whether the field type is integral. 863 */ 864 public boolean isIntegral() { 865 return isIntegral[type]; 866 } 867 868 /** 869 * Returns the number of data items present in the field. For | 826 return new long[count][2]; 827 case TIFFTag.TIFF_SSHORT: 828 return new short[count]; 829 case TIFFTag.TIFF_SLONG: 830 return new int[count]; 831 case TIFFTag.TIFF_SRATIONAL: 832 return new int[count][2]; 833 case TIFFTag.TIFF_FLOAT: 834 return new float[count]; 835 case TIFFTag.TIFF_DOUBLE: 836 return new double[count]; 837 default: 838 throw new IllegalArgumentException("Unknown data type "+dataType); 839 } 840 } 841 842 /** 843 * Returns the {@code TIFFField} as a node named either 844 * <tt>"TIFFField"</tt> or <tt>"TIFFIFD"</tt> as described in the 845 * TIFF native image metadata specification. The node will be named 846 * <tt>"TIFFIFD"</tt> if and only if {@link #hasDirectory()} returns 847 * {@code true} and the field's type is either {@link TIFFTag#TIFF_LONG} 848 * or {@link TIFFTag#TIFF_IFD_POINTER}. 849 * 850 * @return a {@code Node} named <tt>"TIFFField"</tt> or 851 * <tt>"TIFFIFD"</tt>. 852 */ 853 public Node getAsNativeNode() { 854 return new TIFFFieldNode(this); 855 } 856 857 /** 858 * Indicates whether the value associated with the field is of 859 * integral data type. 860 * 861 * @return Whether the field type is integral. 862 */ 863 public boolean isIntegral() { 864 return isIntegral[type]; 865 } 866 867 /** 868 * Returns the number of data items present in the field. For |