Package 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.
- Author:
- Sasa Markovic*
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static StringDEFAULT_SIGNATURE(package private) static StringRRDTOOL_VERSION1(package private) static StringRRDTOOL_VERSION3(package private) static StringSIGNATURE(package private) static intSIGNATURE_LENGTH
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidappendXml(XmlWriter writer)voidcopyStateTo(Header header)copyStateTo.(package private) Stringdump()intgetArcCount()Returns the number of archives defined in the RRD.intgetDsCount()Returns the number of datasources defined in the RRD.StringgetInfo()getInfo.longgetLastUpdateTime()Returns the last update time of the RRD.RrdAllocatorgetRrdAllocator()Required to implement RrdUpdater interface.RrdBackendgetRrdBackend()Returns the underlying storage (backend) object which actually performs all I/O operations.StringgetSignature()Returns RRD signature.longgetStep()Returns primary RRD time step.intgetVersion()Return the RRD version.(package private) booleanisRrd4jHeader()voidsetInfo(String info)setInfo.(package private) voidsetLastUpdateTime(long lastUpdateTime)(package private) voidvalidateHeader()
-
-
-
Field Detail
-
SIGNATURE_LENGTH
static final int SIGNATURE_LENGTH
- See Also:
- Constant Field Values
-
SIGNATURE
static final String SIGNATURE
- See Also:
- Constant Field Values
-
DEFAULT_SIGNATURE
static final String DEFAULT_SIGNATURE
- See Also:
- Constant Field Values
-
RRDTOOL_VERSION1
static final String RRDTOOL_VERSION1
- See Also:
- Constant Field Values
-
RRDTOOL_VERSION3
static final String RRDTOOL_VERSION3
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Header
Header(RrdDb parentDb, RrdDef rrdDef) throws IOException
- Throws:
IOException
-
Header
Header(RrdDb parentDb, DataImporter reader) throws IOException
- Throws:
IOException
-
-
Method Detail
-
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
-
getInfo
public String getInfo() throws IOException
getInfo.
- Returns:
- a
Stringobject. - Throws:
IOException- if any.
-
setInfo
public void setInfo(String info) throws IOException
setInfo.
- Parameters:
info- aStringobject.- Throws:
IOException- if any.
-
getLastUpdateTime
public long getLastUpdateTime() throws IOExceptionReturns 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
-
getStep
public long getStep() throws IOExceptionReturns primary RRD time step.- Returns:
- Primary time step in seconds
- Throws:
IOException- Thrown in case of I/O error
-
getDsCount
public int getDsCount() throws IOExceptionReturns the number of datasources defined in the RRD.- Returns:
- Number of datasources defined
- Throws:
IOException- Thrown in case of I/O error
-
getArcCount
public int getArcCount() throws IOExceptionReturns the number of archives defined in the RRD.- Returns:
- Number of archives defined
- Throws:
IOException- Thrown in case of I/O error
-
setLastUpdateTime
void setLastUpdateTime(long lastUpdateTime) throws IOException- Throws:
IOException
-
dump
String dump() throws IOException
- Throws:
IOException
-
appendXml
void appendXml(XmlWriter writer) throws IOException
- Throws:
IOException
-
copyStateTo
public void copyStateTo(Header header) throws IOException
copyStateTo.
Copies object's internal state to another Header object.- Specified by:
copyStateToin interfaceRrdUpdater<Header>- Parameters:
header- aRrdUpdaterobject.- Throws:
IOException- if any.
-
getRrdBackend
public RrdBackend getRrdBackend()
Returns the underlying storage (backend) object which actually performs all I/O operations.- Specified by:
getRrdBackendin interfaceRrdUpdater<Header>- Returns:
- I/O backend object
-
getVersion
public int getVersion() throws IOExceptionReturn the RRD version.- Returns:
- RRD version
- Throws:
IOException- if any.
-
isRrd4jHeader
boolean isRrd4jHeader()
-
validateHeader
void validateHeader() throws IOException- Throws:
IOException
-
getRrdAllocator
public RrdAllocator getRrdAllocator()
Required to implement RrdUpdater interface. You should never call this method directly.- Specified by:
getRrdAllocatorin interfaceRrdUpdater<Header>- Returns:
- Allocator object
-
-