public class RRDatabase extends Object
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.
|
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 start,
long end,
long step)
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.
|
public RRDatabase(String name) throws IOException
name
- the filename of the file to read from.IOException
- if an I/O error occurs.public RRDatabase(File file) throws IOException
file
- the file to read from.IOException
- if an I/O error occurs.public Header getHeader()
Header
for this database.Header
for this database.public Set<String> getDataSourcesName()
getDataSourcesName.
Set
object.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.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 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 start, long end, long step) throws IOException
getData.
type
- a ConsolidationFunctionType
object.start
- a long.end
- a long.step
- a long.DataChunk
object.IOException
- if any.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)
s
- the PrintStream to send the XML to.Copyright © 2015. All rights reserved.