public class RRDatabase extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
(package private) Header |
header |
(package private) Date |
lastUpdate
Timestamp of last data modification
|
(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. |
Archive |
getArchive(String name)
getArchive.
|
(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,
Date startDate,
Date endDate,
long step)
Returns data from the database corresponding to the given consolidation function.
|
DataChunk |
getData(ConsolidationFunctionType type,
long startTime,
long endTime,
long stepSeconds)
getData.
|
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.
|
Set<String> |
getDataSourcesName()
getDataSourcesName.
|
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.
|
final Header header
final Date lastUpdate
final RRDFile rrdFile
public RRDatabase(File file) throws IOException
file - the file to read from.IOException - if an I/O error occurs.public RRDatabase(String name) throws IOException
name - the filename of the file to read from.IOException - if an I/O error occurs.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - if an I/O error occurs.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.ArrayList<Archive> getArchiveList(ConsolidationFunctionType type)
public Iterator<Archive> getArchives()
public Iterator<Archive> getArchives(ConsolidationFunctionType type)
type - the consolidation function that should have been applied to the data.public DataChunk getData(ConsolidationFunctionType type) throws IOException
type - the consolidation function that should have been applied to the data.IllegalArgumentException - 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, Date startDate, Date endDate, long step) throws IOException
type - the consolidation function that should have been applied to the data.step - the step size to use.startDate - a Date object.endDate - a Date object.IllegalArgumentException - 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 startTime, long endTime, long stepSeconds) throws IOException
type - a ConsolidationFunctionType object.startTime - seconds since epochendTime - seconds since epochstepSeconds - in secondsDataChunk object.IOException - if any.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 Set<String> getDataSourcesName()
Set object.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 int getNumArchives()
public void printInfo(PrintStream s)
double is 0.0000000000E0.s - the PrintStream to print the header information to.public void printInfo(PrintStream s, NumberFormat numberFormat)
s - the PrintStream to print the header information to.numberFormat - the format to print doubles as.public String toString()
public void toXml(PrintStream s)
A flush is issued at the end of the XML generation, so auto flush of the PrintStream can be set to false
s - the PrintStream to send the XML to.