Class COGHeader


  • public class COGHeader
    extends Object
    Represents a header for a COG file. This includes IFDs, endianess etc.
    • Constructor Detail

      • COGHeader

        public COGHeader​(boolean isLittleEndian)
    • Method Detail

      • setIFD

        public void setIFD​(IFDTag[] IFD)
      • getIFD

        public IFDTag[] getIFD()
      • addAdditionalIFD

        public void addAdditionalIFD​(IFDTag[] IFD)
      • getSingleAdditionalIFD

        public IFDTag[] getSingleAdditionalIFD​(int index)
      • setSingleAdditionalIFD

        public void setSingleAdditionalIFD​(int index,
                                           IFDTag[] IFD)
      • removeSingleAdditionalIFD

        public void removeSingleAdditionalIFD​(int index)
      • setLittleEndian

        public void setLittleEndian​(boolean isLittleEndian)
      • isLittleEndian

        public boolean isLittleEndian()
      • setGDALMetadata

        public void setGDALMetadata​(String GDALMetadata)
      • getGDALMetadata

        public String getGDALMetadata()
      • setBigTIFF

        public void setBigTIFF​(boolean isBigTIFF)
      • isBigTIFF

        public boolean isBigTIFF()
      • parseByteArray

        public Number parseByteArray​(byte[] bytes,
                                     int length,
                                     int offset,
                                     boolean isDecimal,
                                     boolean isSigned,
                                     boolean isRational)
        Parses a byte array into a generic number. Can be byte, short, int, float or double depending on the options given. E.g.: Use .doubleValue() on the result to get a double value easily Supported lengths: isDecimal: - 4 bytes: float - 8 bytes: double otherwise: - 1 byte: byte - 2 bytes: short - 4 bytes: int Anything else will throw an exception
        Parameters:
        bytes - ???
        length - number of bytes that should be read
        offset - from the start of the byte array
        isDecimal - Whether we are dealing with a floating point number
        isSigned - Whether the number is signed
        isRational - Whether the number is a rational number as specified in the TIFF standard (first 32 bit integer numerator of a fraction, second 32 bit integer denominator)
        Returns:
        ???
      • readCOGHeader

        public static COGHeader readCOGHeader​(COGByteReader byteReader)
        Reads the COG header from the BufferedInputStream. Handles little endian setting, checking magic number. After this you manually have to check the compatibility though if you desire to do so.
        Parameters:
        byteReader - ???
        Returns:
        filled COGHeader object
      • isCompatible

        public static String isCompatible​(IFDTag[] IFD)
        Checks a given header for compatibility with the reader
        Parameters:
        IFD - ???
        Returns:
        empty string if compatible, error message otherwise