Class AbstractFieldType

java.lang.Object
org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType
Direct Known Subclasses:
FieldTypeAscii, FieldTypeByte, FieldTypeDouble, FieldTypeFloat, FieldTypeLong, FieldTypeLong8, FieldTypeRational, FieldTypeShort

public abstract class AbstractFieldType extends Object
TIFF field types.
  • Field Details

    • BYTE

      public static final FieldTypeByte BYTE
      Byte field type.
    • ASCII

      public static final FieldTypeAscii ASCII
      ASCII field type.
    • SHORT

      public static final FieldTypeShort SHORT
      Short field type.
    • LONG

      public static final FieldTypeLong LONG
      Long field type.
    • RATIONAL

      public static final FieldTypeRational RATIONAL
      Rational field type.
    • SBYTE

      public static final FieldTypeByte SBYTE
      SByte field type.
    • UNDEFINED

      public static final FieldTypeByte UNDEFINED
      Undefined field type.
    • SSHORT

      public static final FieldTypeShort SSHORT
      SShort field type.
    • SLONG

      public static final FieldTypeLong SLONG
      SLong field type.
    • SRATIONAL

      public static final FieldTypeRational SRATIONAL
      SRational field type.
    • FLOAT

      public static final FieldTypeFloat FLOAT
      Float field type.
    • DOUBLE

      public static final FieldTypeDouble DOUBLE
      Double field type.
    • IFD

      public static final FieldTypeLong IFD
      IFD field type.
    • LONG8

      public static final FieldTypeLong8 LONG8
      Long8 field type.
    • SLONG8

      public static final FieldTypeLong8 SLONG8
      SLong8 field type.
    • IFD8

      public static final FieldTypeLong8 IFD8
      IFD8 field type.
    • ANY

      public static final List<AbstractFieldType> ANY
      Unmodifiable List of all field types.
    • SHORT_OR_LONG

      public static final List<AbstractFieldType> SHORT_OR_LONG
      Unmodifiable List of SHORT, LONG field types.
    • SHORT_OR_RATIONAL

      public static final List<AbstractFieldType> SHORT_OR_RATIONAL
      Unmodifiable List of SHORT, RATIONAL field types.
    • SHORT_OR_LONG_OR_RATIONAL

      public static final List<AbstractFieldType> SHORT_OR_LONG_OR_RATIONAL
      Unmodifiable List of SHORT, LONG, RATIONAL field types.
    • LONG_OR_SHORT

      public static final List<AbstractFieldType> LONG_OR_SHORT
      Unmodifiable List of SHORT, LONG field types.
    • BYTE_OR_SHORT

      public static final List<AbstractFieldType> BYTE_OR_SHORT
      Unmodifiable List of SHORT, BYTE field types.
    • LONG_OR_IFD

      public static final List<AbstractFieldType> LONG_OR_IFD
      Unmodifiable List of LONG, IFD field types.
    • ASCII_OR_RATIONAL

      public static final List<AbstractFieldType> ASCII_OR_RATIONAL
      Unmodifiable List of ASCII, RATIONAL field types.
    • ASCII_OR_BYTE

      public static final List<AbstractFieldType> ASCII_OR_BYTE
      Unmodifiable List of ASCII, BYTE field types.
    • type

      private final int type
    • name

      private final String name
    • elementSize

      private final int elementSize
  • Constructor Details

    • AbstractFieldType

      protected AbstractFieldType(int type, String name, int elementSize)
      Constructs a new instance.
      Parameters:
      type - the type.
      name - the name.
      elementSize - the element size.
  • Method Details

    • getFieldType

      public static AbstractFieldType getFieldType(int type) throws ImagingException
      Gets a known field type.
      Parameters:
      type - the type to find.
      Returns:
      the matching field type.
      Throws:
      ImagingException - thrown when not found.
    • getName

      public String getName()
      Gets the name.
      Returns:
      the name.
    • getSize

      public int getSize()
      Gets the size.
      Returns:
      the size.
    • getType

      public int getType()
      Gets the type.
      Returns:
      the type.
    • getValue

      public abstract Object getValue(TiffField entry)
      Gets the value from a TIFF field.
      Parameters:
      entry - the TIFF field.
      Returns:
      the value.
    • writeData

      public abstract byte[] writeData(Object obj, ByteOrder byteOrder) throws ImagingException
      Converts the given object to a byte array.
      Parameters:
      obj - input.
      byteOrder - output byte order; not used by all subclasses.
      Returns:
      a byte array.
      Throws:
      ImagingException - Thrown on a bad input.