public class RRDatabase extends Object
Modifier and Type | Field and Description |
---|---|
(package private) ArrayList<Archive> |
archives |
(package private) ArrayList<DataSource> |
dataSources |
(package private) Header |
header |
(package private) Date |
lastUpdate |
(package private) RRDFile |
rrdFile |
Constructor and Description |
---|
RRDatabase(File file)
Creates a database to read from.
|
RRDatabase(String name)
Creates a database to read from.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this database stream and releases any associated system resources.
|
Archive |
getArchive(int index)
Returns the
Archive at the specified position in this database. |
(package private) ArrayList<Archive> |
getArchiveList(ConsolidationFunctionType type) |
Iterator<Archive> |
getArchives()
Returns an iterator over the archives in this database in proper sequence.
|
Iterator<Archive> |
getArchives(ConsolidationFunctionType type)
Returns an iterator over the archives in this database of the given type
in proper sequence.
|
DataChunk |
getData(ConsolidationFunctionType type)
Returns data from the database corresponding to the given consolidation
function and a step size of 1.
|
DataChunk |
getData(ConsolidationFunctionType type,
long step)
Returns data from the database corresponding to the given consolidation
function.
|
DataSource |
getDataSource(int index)
Returns the
DataSource at the specified position in this database. |
Iterator<DataSource> |
getDataSources()
Returns an iterator over the data sources in this database in proper sequence.
|
Header |
getHeader()
Returns the
Header for this database. |
Date |
getLastUpdate()
Returns the date this database was last updated.
|
int |
getNumArchives()
Returns the number of archives in this database.
|
void |
printInfo(PrintStream s)
Outputs the header information of the database to the given print stream
using the default number format.
|
void |
printInfo(PrintStream s,
NumberFormat numberFormat)
Outputs the header information of the database to the given print stream
using the given number format.
|
String |
toString()
Returns a summary the contents of this database.
|
void |
toXml(PrintStream s)
Outputs the content of the database to the given print stream
as a stream of XML.
|
RRDFile rrdFile
Header header
ArrayList<DataSource> dataSources
Date lastUpdate
public RRDatabase(String name) throws IOException, RrdException
name
- the filename of the file to read from.IOException
- if an I/O error occurs.RrdException
public RRDatabase(File file) throws IOException, RrdException
file
- the file to read from.IOException
- if an I/O error occurs.RrdException
public Header getHeader()
Header
for this database.Header
for this database.public Date getLastUpdate()
rrdtool last
call Date.getTime() and
divide the result by 1000.public DataSource getDataSource(int index)
DataSource
at the specified position in this database.index
- index of DataSource
to return.DataSource
at the specified position in this databasepublic Iterator<DataSource> getDataSources()
public Archive getArchive(int index)
Archive
at the specified position in this database.index
- index of Archive
to return.Archive
at the specified position in this database.public Iterator<Archive> getArchives()
public int getNumArchives()
public Iterator<Archive> getArchives(ConsolidationFunctionType type)
type
- the consolidation function that should have been applied to
the data.ArrayList<Archive> getArchiveList(ConsolidationFunctionType type)
public void close() throws IOException
IOException
- if an I/O error occurs.public void printInfo(PrintStream s)
double
is 0.0000000000E0.s
- the PrintStream to print the header information to.public DataChunk getData(ConsolidationFunctionType type) throws RrdException, IOException
type
- the consolidation function that should have been applied to
the data.RrdException
- if there was a problem locating a data archive with
the requested consolidation function.IOException
- if there was a problem reading data from the database.public DataChunk getData(ConsolidationFunctionType type, long step) throws RrdException, IOException
type
- the consolidation function that should have been applied to
the data.step
- the step size to use.RrdException
- if there was a problem locating a data archive with
the requested consolidation function.IOException
- if there was a problem reading data from the database.public void printInfo(PrintStream s, NumberFormat numberFormat)
s
- the PrintStream to print the header information to.numberFormat
- the format to print double
s as.public void toXml(PrintStream s) throws RrdException
s
- the PrintStream to send the XML to.RrdException