Package org.apache.sysds.runtime.io.cog

## Class COGHeader

- java.lang.Object
- - org.apache.sysds.runtime.io.cog.COGHeader

    public class COGHeader
    extends Object

Represents a header for a COG file. This includes IFDs, endianess etc.

### Constructor Summary

Constructors
`COGHeader​(boolean isLittleEndian)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `addAdditionalIFD​(IFDTag[] IFD)`
`ArrayList<IFDTag[]>` `getAdditionalIFDs()`
`String` `getGDALMetadata()`
`IFDTag[]` `getIFD()`
`IFDTag[]` `getSingleAdditionalIFD​(int index)`
`boolean` `isBigTIFF()`
`static String` `isCompatible​(IFDTag[] IFD)` Checks a given header for compatibility with the reader
`boolean` `isLittleEndian()`
`Number` `parseByteArray​(byte[] bytes, int length, int offset, boolean isDecimal, boolean isSigned, boolean isRational)` Parses a byte array into a generic number.
`static COGHeader` `readCOGHeader​(COGByteReader byteReader)` Reads the COG header from the BufferedInputStream.
`void` `removeSingleAdditionalIFD​(int index)`
`void` `setBigTIFF​(boolean isBigTIFF)`
`void` `setGDALMetadata​(String GDALMetadata)`
`void` `setIFD​(IFDTag[] IFD)`
`void` `setLittleEndian​(boolean isLittleEndian)`
`void` `setSingleAdditionalIFD​(int index, IFDTag[] IFD)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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)

#### getAdditionalIFDs

    public ArrayList<IFDTag[]> getAdditionalIFDs()

#### 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