org.rrd4j.core

## Class Header

- java.lang.Object
- - org.rrd4j.core.Header

- All Implemented Interfaces:
    RrdUpdater<Header>

      public class Header
      extends Object
      implements RrdUpdater<Header>

  Class to represent RRD header. Header information is mainly static (once set, it cannot be changed), with the exception of last update time (this value is changed whenever RRD gets updated).

  Normally, you don't need to manipulate the Header object directly - Rrd4j framework does it for you.

  This header contains metadata about the RRD file.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) static String` | `DEFAULT_SIGNATURE` Default signature string for RRD files created by RRD4J.
    `(package private) static String` | `RRDTOOL_VERSION1` Version identifier for RRDTool version 1 compatibility.
    `(package private) static String` | `RRDTOOL_VERSION3` Version identifier for RRDTool version 3 compatibility.
    `(package private) static String` | `SIGNATURE` RRD4J signature string used to identify RRD4J files.
    `(package private) static int` | `SIGNATURE_LENGTH` Length of the RRD signature string.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Header(RrdDb parentDb, DataImporter reader)`
    `Header(RrdDb parentDb, RrdDef rrdDef)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `appendXml(XmlWriter writer)` Appends header information to XML writer.
    `void` | `copyStateTo(Header header)` copyStateTo.
    `(package private) String` | `dump()` Returns a string representation of the header information.
    `int` | `getArcCount()` Returns the number of archives defined in the RRD.
    `int` | `getDsCount()` Returns the number of datasources defined in the RRD.
    `String` | `getInfo()` getInfo.
    `long` | `getLastUpdateTime()` Returns the last update time of the RRD.
    `RrdAllocator` | `getRrdAllocator()` Required to implement RrdUpdater interface.
    `RrdBackend` | `getRrdBackend()` Returns the underlying storage (backend) object which actually performs all I/O operations.
    `String` | `getSignature()` Returns RRD signature.
    `long` | `getStep()` Returns primary RRD time step.
    `int` | `getVersion()` Return the RRD version.
    `(package private) boolean` | `isRrd4jHeader()`
    `void` | `setInfo(String info)` setInfo.
    `(package private) void` | `setLastUpdateTime(long lastUpdateTime)` Sets the last update time of the RRD.
    `(package private) void` | `validateHeader()`

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

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

- - ### Field Detail

    - #### DEFAULT_SIGNATURE

          static final String DEFAULT_SIGNATURE

      Default signature string for RRD files created by RRD4J.
      See Also:
        Constant Field Values

    - #### RRDTOOL_VERSION1

          static final String RRDTOOL_VERSION1

      Version identifier for RRDTool version 1 compatibility.
      See Also:
        Constant Field Values

    - #### RRDTOOL_VERSION3

          static final String RRDTOOL_VERSION3

      Version identifier for RRDTool version 3 compatibility.
      See Also:
        Constant Field Values

    - #### SIGNATURE

          static final String SIGNATURE

      RRD4J signature string used to identify RRD4J files.
      See Also:
        Constant Field Values

    - #### SIGNATURE_LENGTH

          static final int SIGNATURE_LENGTH

      Length of the RRD signature string.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Header

          Header(RrdDb parentDb,
                 DataImporter reader)
          throws IOException

      Throws:
        `IOException`

    - #### Header

          Header(RrdDb parentDb,
                 RrdDef rrdDef)
          throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### appendXml

          void appendXml(XmlWriter writer)
                  throws IOException

      Appends header information to XML writer.
      Parameters:
        `writer` - the XML writer to append to
      Throws:
        `IOException` - if an I/O error occurs

    - #### copyStateTo

          public void copyStateTo(Header header)
                           throws IOException

      copyStateTo.

      Copies object's internal state to another Header object.

      Specified by:
        `copyStateTo` in interface `RrdUpdater<Header>`
      Parameters:
        `header` - a `RrdUpdater` object.
      Throws:
        `IOException` - if any.

    - #### dump

          String dump()
               throws IOException

      Returns a string representation of the header information.
      Returns:
        a string containing header information
      Throws:
        `IOException` - if an I/O error occurs

    - #### getArcCount

          public int getArcCount()
                          throws IOException

      Returns the number of archives defined in the RRD.
      Returns:
        Number of archives defined
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### getDsCount

          public int getDsCount()
                         throws IOException

      Returns the number of datasources defined in the RRD.
      Returns:
        Number of datasources defined
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### getInfo

          public String getInfo()
                         throws IOException

      getInfo.
      Returns:
        a `String` object.
      Throws:
        `IOException` - if any.

    - #### getLastUpdateTime

          public long getLastUpdateTime()
                                 throws IOException

      Returns the last update time of the RRD.
      Returns:
        Timestamp (Unix epoch, no milliseconds) corresponding to the last update time.
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### getRrdAllocator

          public RrdAllocator getRrdAllocator()

      Required to implement RrdUpdater interface. You should never call this method directly.
      Specified by:
        `getRrdAllocator` in interface `RrdUpdater<Header>`
      Returns:
        Allocator object

    - #### getRrdBackend

          public RrdBackend getRrdBackend()

      Returns the underlying storage (backend) object which actually performs all I/O operations.
      Specified by:
        `getRrdBackend` in interface `RrdUpdater<Header>`
      Returns:
        I/O backend object

    - #### getSignature

          public String getSignature()
                              throws IOException

      Returns RRD signature. Initially, the returned string will be of the form Rrd4j, version x.x.
      Returns:
        RRD signature
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### getStep

          public long getStep()
                       throws IOException

      Returns primary RRD time step.
      Returns:
        Primary time step in seconds
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### getVersion

          public int getVersion()
                         throws IOException

      Return the RRD version.
      Returns:
        RRD version
      Throws:
        `IOException` - if any.

    - #### isRrd4jHeader

          boolean isRrd4jHeader()

    - #### setInfo

          public void setInfo(String info)
                       throws IOException

      setInfo.
      Parameters:
        `info` - a `String` object.
      Throws:
        `IOException` - if any.

    - #### setLastUpdateTime

          void setLastUpdateTime(long lastUpdateTime)
                          throws IOException

      Sets the last update time of the RRD.
      Parameters:
        `lastUpdateTime` - the last update time (Unix epoch)
      Throws:
        `IOException` - if an I/O error occurs

    - #### validateHeader

          void validateHeader()
                       throws IOException

      Throws:
        `IOException`