Java Doc for TIFFField.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » com » sun » media » imageio » plugins » tiff » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » com.sun.media.imageio.plugins.tiff 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.media.imageio.plugins.tiff.TIFFField

TIFFField
public class TIFFField implements Comparable(Code)
A class representing a field in a TIFF 6.0 Image File Directory.

A field in a TIFF Image File Directory (IFD) is defined as a tag number accompanied by a sequence of values of identical data type. TIFF 6.0 defines 12 data types; a 13th type IFD is defined in TIFF Tech Note 1 of TIFF Specification Supplement 1. These TIFF data types are referred to by Java constants and mapped internally onto Java language data types and type names as follows:

TIFF Data Type Java Constant Java Data Type Java Type Name
BYTE TIFFTag.TIFF_BYTE byte "Byte"
ASCII TIFFTag.TIFF_ASCII String "Ascii"
SHORT TIFFTag.TIFF_SHORT char "Short"
LONG TIFFTag.TIFF_LONG long "Long"
RATIONAL TIFFTag.TIFF_RATIONAL long[2] {numerator, denominator} "Rational"
SBYTE TIFFTag.TIFF_SBYTE byte "SByte"
UNDEFINED TIFFTag.TIFF_UNDEFINED byte "Undefined"
SSHORT TIFFTag.TIFF_SSHORT short "SShort"
SLONG TIFFTag.TIFF_SLONG int "SLong"
SRATIONAL TIFFTag.TIFF_SRATIONAL int[2] {numerator, denominator} "SRational"
FLOAT TIFFTag.TIFF_FLOAT float "Float"
DOUBLE TIFFTag.TIFF_DOUBLE double "Double"
IFD TIFFTag.TIFF_IFD_POINTER long "IFDPointer"

See Also:   TIFFDirectory
See Also:   TIFFTag




Constructor Summary
public  TIFFField(TIFFTag tag, int type, int count, Object data)
     Constructs a TIFFField with arbitrary data.
public  TIFFField(TIFFTag tag, int type, int count)
     Constructs a data array using TIFFField.createArrayForTypecreateArrayForType() and invokes TIFFField.TIFFField(TIFFTag,int,int,Object) with the supplied parameters and the created array.
public  TIFFField(TIFFTag tag, int value)
     Constructs a TIFFField with a single integral value.

Method Summary
public  intcompareTo(Object o)
     Compares this TIFFField with another TIFFField by comparing the tags.
public static  ObjectcreateArrayForType(int dataType, int count)
     Creates an array appropriate for the indicated data type.
public static  TIFFFieldcreateFromMetadataNode(TIFFTagSet tagSet, Node node)
     Creates a TIFFField from a TIFF native image metadata node.
public  byte[]getAsBytes()
     Returns the data as an uninterpreted array of bytes.
public  char[]getAsChars()
     Returns TIFFTag.TIFF_SHORT data as an array of chars (unsigned 16-bit integers).
public  doublegetAsDouble(int index)
     Returns data in any format as a double.
public  double[]getAsDoubles()
     Returns TIFFTag.TIFF_DOUBLE data as an array of doubles (64-bit floating-point values).
public  floatgetAsFloat(int index)
     Returns data in any format as a float.
public  float[]getAsFloats()
     Returns TIFFTag.TIFF_FLOAT data as an array of floats (32-bit floating-point values).
public  intgetAsInt(int index)
     Returns data in any format as an int.

TIFFTag.TIFF_BYTE values are treated as unsigned; that is, no sign extension will take place and the returned value will be in the range [0, 255].

public  int[]getAsInts()
     Returns TIFFTag.TIFF_SLONG data as an array of ints (signed 32-bit integers).
public  longgetAsLong(int index)
     Returns data in any format as a long.
public  long[]getAsLongs()
     Returns TIFFTag.TIFF_LONG or TIFF_IFD_POINTER data as an array of longs (signed 64-bit integers).
public  NodegetAsNativeNode()
     Returns the TIFFField as a node named either "TIFFField" or "TIFFIFD" as described in the TIFF native image metadata specification.
public  long[]getAsRational(int index)
     Returns a TIFFTag.TIFF_RATIONAL data item as a two-element array of ints.
public  long[][]getAsRationals()
     Returns TIFFTag.TIFF_RATIONAL data as an array of 2-element arrays of longs.
public  int[]getAsSRational(int index)
     Returns a TIFFTag.TIFF_SRATIONAL data item as a two-element array of ints.
public  int[][]getAsSRationals()
     Returns TIFFTag.TIFF_SRATIONAL data as an array of 2-element arrays of ints.
public  short[]getAsShorts()
     Returns TIFFTag.TIFF_SSHORT data as an array of shorts (signed 16-bit integers).
public  StringgetAsString(int index)
     Returns a TIFFTag.TIFF_ASCII value as a String.
public  intgetCount()
     Returns the number of data items present in the field.
public  ObjectgetData()
     Returns a reference to the data object associated with the field.
public  TIFFTaggetTag()
     Retrieves the tag associated with this field.
public  intgetTagNumber()
     Retrieves the tag number in the range [0, 65535].
public  intgetType()
     Returns the type of the data stored in the field.
public static  intgetTypeByName(String typeName)
     Returns the data type constant corresponding to the supplied data type name.
public static  StringgetTypeName(int dataType)
     Returns the name of the supplied data type constant.
Parameters:
  dataType - One of the TIFFTag.TIFF_* constantsindicating the data type of the field as written to the TIFF stream.
public  StringgetValueAsString(int index)
     Returns a String containing a human-readable version of the data item.
public  booleanisIntegral()
     Indicates whether the value associated with the field is of integral data type.


Constructor Detail
TIFFField
public TIFFField(TIFFTag tag, int type, int count, Object data)(Code)
Constructs a TIFFField with arbitrary data. The type parameter must be a value for which TIFFTag.isDataTypeOK tag.isDataTypeOK() returns true. The data parameter must be an array of a Java type appropriate for the type of the TIFF field unless TIFFTag.isIFDPointertag.isIFDPointer() returns true in which case it must be a TIFFDirectory instance.

Neither the legality of type with respect to tag nor that or data with respect to type is verified by this constructor. The methods TIFFTag.isDataTypeOK TIFFTag.isDataTypeOK() and TIFFField.createArrayForType createArrayForType() should be used programmatically to ensure that subsequent errors such as ClassCastExceptions do not occur as a result of providing inconsitent parameters to this constructor.

Note that the value (data) of the TIFFField will always be the actual field value regardless of the number of bytes required for that value. This is the case despite the fact that the TIFF IFD Entry corresponding to the field may actually contain the offset to the field's value rather than the value itself (the latter occurring if and only if the value fits into 4 bytes). In other words, the value of the field will already have been read from the TIFF stream. This subsumes the case where tag.isIFDPointer() returns true and the value will be a TIFFDirectory rather than an array.


Parameters:
  tag - The tag to associated with this field.
Parameters:
  type - One of the TIFFTag.TIFF_* constantsindicating the data type of the field as written to the TIFF stream.
Parameters:
  count - The number of data values.
Parameters:
  data - The actual data content of the field.
throws:
  IllegalArgumentException - if tag == null.
throws:
  IllegalArgumentException - if dataType is notone of the TIFFTag.TIFF_* data type constants.
throws:
  IllegalArgumentException - if count < 0.



TIFFField
public TIFFField(TIFFTag tag, int type, int count)(Code)
Constructs a data array using TIFFField.createArrayForTypecreateArrayForType() and invokes TIFFField.TIFFField(TIFFTag,int,int,Object) with the supplied parameters and the created array.
See Also:   TIFFField.TIFFField(TIFFTag,int,int,Object)



TIFFField
public TIFFField(TIFFTag tag, int value)(Code)
Constructs a TIFFField with a single integral value. The field will have type TIFFTag.TIFF_SHORT TIFF_SHORT if val < 65536 and type TIFFTag.TIFF_LONG TIFF_LONG otherwise. It is not verified whether the resulting type is legal for tag.
Parameters:
  tag - The tag to associate with this field.
Parameters:
  value - The value to associate with this field.
throws:
  IllegalArgumentException - if tag == null.
throws:
  IllegalArgumentException - if value < 0.




Method Detail
compareTo
public int compareTo(Object o)(Code)
Compares this TIFFField with another TIFFField by comparing the tags.

Note: this class has a natural ordering that is inconsistent with equals().
throws:
  IllegalArgumentException - if the parameter is null.
throws:
  ClassCastException - if the parameter is not aTIFFField.




createArrayForType
public static Object createArrayForType(int dataType, int count)(Code)
Creates an array appropriate for the indicated data type.
Parameters:
  dataType - One of the TIFFTag.TIFF_* data typeconstants.
Parameters:
  count - The number of values in the array.
throws:
  IllegalArgumentException - if dataType is notone of the TIFFTag.TIFF_* data type constants.
throws:
  IllegalArgumentException - if count < 0.



createFromMetadataNode
public static TIFFField createFromMetadataNode(TIFFTagSet tagSet, Node node)(Code)
Creates a TIFFField from a TIFF native image metadata node. If the value of the "tagNumber" attribute of the node is not found in tagSet then a new TIFFTag with name "unknown" will be created and assigned to the field.
Parameters:
  tagSet - The TIFFTagSet to which theTIFFTag of the field belongs.
Parameters:
  node - A native TIFF image metadata TIFFField node.
throws:
  IllegalArgumentException - if node isnull.
throws:
  IllegalArgumentException - if the name of the node is not"TIFFField".



getAsBytes
public byte[] getAsBytes()(Code)
Returns the data as an uninterpreted array of bytes. The type of the field must be one of TIFFTag.TIFF_BYTE, TIFF_SBYTE, or TIFF_UNDEFINED.

For data in TIFFTag.TIFF_BYTE format, the application must take care when promoting the data to longer integral types to avoid sign extension.
throws:
  ClassCastException - if the field is not of typeTIFF_BYTE, TIFF_SBYTE, orTIFF_UNDEFINED.




getAsChars
public char[] getAsChars()(Code)
Returns TIFFTag.TIFF_SHORT data as an array of chars (unsigned 16-bit integers).
throws:
  ClassCastException - if the field is not of typeTIFF_SHORT.



getAsDouble
public double getAsDouble(int index)(Code)
Returns data in any format as a double.

TIFFTag.TIFF_BYTE and TIFF_UNDEFINED data are treated as unsigned; that is, no sign extension will take place and the returned value will be in the range [0, 255]. TIFF_SBYTE data will be returned in the range [-128, 127].

Data in TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by dividing the numerator into the denominator using double-precision arithmetic.

Data in TIFF_ASCII format will be parsed as by the Double.parseDouble method.




getAsDoubles
public double[] getAsDoubles()(Code)
Returns TIFFTag.TIFF_DOUBLE data as an array of doubles (64-bit floating-point values).
throws:
  ClassCastException - if the field is not of typeTIFF_DOUBLE.



getAsFloat
public float getAsFloat(int index)(Code)
Returns data in any format as a float.

TIFFTag.TIFF_BYTE and TIFF_UNDEFINED data are treated as unsigned; that is, no sign extension will take place and the returned value will be in the range [0, 255]. TIFF_SBYTE data will be returned in the range [-128, 127].

Data in TIFF_SLONG, TIFF_LONG, TIFF_DOUBLE, or TIFF_IFD_POINTER format are simply cast to float and may suffer from truncation.

Data in TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by dividing the numerator into the denominator using double-precision arithmetic and then casting to float.

Data in TIFF_ASCII format will be parsed as by the Double.parseDouble method, with the result cast to float.




getAsFloats
public float[] getAsFloats()(Code)
Returns TIFFTag.TIFF_FLOAT data as an array of floats (32-bit floating-point values).
throws:
  ClassCastException - if the field is not of typeTIFF_FLOAT.



getAsInt
public int getAsInt(int index)(Code)
Returns data in any format as an int.

TIFFTag.TIFF_BYTE values are treated as unsigned; that is, no sign extension will take place and the returned value will be in the range [0, 255]. TIFF_SBYTE data will be returned in the range [-128, 127].

A TIFF_UNDEFINED value is treated as though it were a TIFF_BYTE.

Data in TIFF_SLONG, TIFF_LONG, TIFF_FLOAT, TIFF_DOUBLE or TIFF_IFD_POINTER format are simply cast to int and may suffer from truncation.

Data in TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by dividing the numerator into the denominator using double-precision arithmetic and then casting to int. Loss of precision and truncation may occur.

Data in TIFF_ASCII format will be parsed as by the Double.parseDouble method, with the result case to int.




getAsInts
public int[] getAsInts()(Code)
Returns TIFFTag.TIFF_SLONG data as an array of ints (signed 32-bit integers).
throws:
  ClassCastException - if the field is not of typeTIFF_SHORT, TIFF_SSHORT, orTIFF_SLONG.



getAsLong
public long getAsLong(int index)(Code)
Returns data in any format as a long.

TIFFTag.TIFF_BYTE and TIFF_UNDEFINED data are treated as unsigned; that is, no sign extension will take place and the returned value will be in the range [0, 255]. TIFF_SBYTE data will be returned in the range [-128, 127].

Data in TIFF_ASCII format will be parsed as by the Double.parseDouble method, with the result cast to long.




getAsLongs
public long[] getAsLongs()(Code)
Returns TIFFTag.TIFF_LONG or TIFF_IFD_POINTER data as an array of longs (signed 64-bit integers).
throws:
  ClassCastException - if the field is not of typeTIFF_LONG or TIFF_IFD_POINTER.



getAsNativeNode
public Node getAsNativeNode()(Code)
Returns the TIFFField as a node named either "TIFFField" or "TIFFIFD" as described in the TIFF native image metadata specification. The node will be named "TIFFIFD" if and only if the field's data object is an instance of TIFFDirectory or equivalently TIFFTag.isIFDPointer getTag.isIFDPointer() returns true. a Node named "TIFFField" or"TIFFIFD".



getAsRational
public long[] getAsRational(int index)(Code)
Returns a TIFFTag.TIFF_RATIONAL data item as a two-element array of ints.
throws:
  ClassCastException - if the field is not of typeTIFF_RATIONAL.



getAsRationals
public long[][] getAsRationals()(Code)
Returns TIFFTag.TIFF_RATIONAL data as an array of 2-element arrays of longs.
throws:
  ClassCastException - if the field is not of typeTIFF_RATIONAL.



getAsSRational
public int[] getAsSRational(int index)(Code)
Returns a TIFFTag.TIFF_SRATIONAL data item as a two-element array of ints.
throws:
  ClassCastException - if the field is not of typeTIFF_SRATIONAL.



getAsSRationals
public int[][] getAsSRationals()(Code)
Returns TIFFTag.TIFF_SRATIONAL data as an array of 2-element arrays of ints.
throws:
  ClassCastException - if the field is not of typeTIFF_SRATIONAL.



getAsShorts
public short[] getAsShorts()(Code)
Returns TIFFTag.TIFF_SSHORT data as an array of shorts (signed 16-bit integers).
throws:
  ClassCastException - if the field is not of typeTIFF_SSHORT.



getAsString
public String getAsString(int index)(Code)
Returns a TIFFTag.TIFF_ASCII value as a String.
throws:
  ClassCastException - if the field is not of typeTIFF_ASCII.



getCount
public int getCount()(Code)
Returns the number of data items present in the field. For TIFFTag.TIFF_ASCII fields, the value returned is the number of Strings, not the total length of the data as in the file representation.



getData
public Object getData()(Code)
Returns a reference to the data object associated with the field. The data object of the field.



getTag
public TIFFTag getTag()(Code)
Retrieves the tag associated with this field. The associated TIFFTag.



getTagNumber
public int getTagNumber()(Code)
Retrieves the tag number in the range [0, 65535]. The tag number.



getType
public int getType()(Code)
Returns the type of the data stored in the field. For a TIFF 6.0 stream, the value will equal one of the TIFFTag.TIFF_* constants. For future revisions of TIFF, higher values are possible. The data type of the field value.



getTypeByName
public static int getTypeByName(String typeName)(Code)
Returns the data type constant corresponding to the supplied data type name. If the name is unknown -1 will be returned. One of the TIFFTag.TIFF_* constants or-1 if the name is not recognized.



getTypeName
public static String getTypeName(int dataType)(Code)
Returns the name of the supplied data type constant.
Parameters:
  dataType - One of the TIFFTag.TIFF_* constantsindicating the data type of the field as written to the TIFF stream. The type name corresponding to the supplied type constant.
throws:
  IllegalArgumentException - if dataType is notone of the TIFFTag.TIFF_* data type constants.



getValueAsString
public String getValueAsString(int index)(Code)
Returns a String containing a human-readable version of the data item. Data of type TIFFTag.TIFF_RATIONAL or TIFF_SRATIONAL are represented as a pair of integers separated by a '/' character.
throws:
  ClassCastException - if the field is not of one of thelegal field types.



isIntegral
public boolean isIntegral()(Code)
Indicates whether the value associated with the field is of integral data type. Whether the field type is integral.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.