Package org.jrobin.core.jrrd
Class RRDFile
- java.lang.Object
-
- org.jrobin.core.jrrd.RRDFile
-
- All Implemented Interfaces:
Constants
public class RRDFile extends Object implements Constants
This class is a quick hack to read information from an RRD file. Writing to RRD files is not currently supported. As I said, this is a quick hack. Some thought should be put into the overall design of the file IO.Currently this can read RRD files that were generated on Solaris (Sparc) and Linux (x86).
- Version:
- $Revision$
- Author:
- Ciaran Treanor
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intalignment(package private) booleanbigEndian(package private) byte[]buffer(package private) booleandebug(package private) RandomAccessFileras-
Fields inherited from interface org.jrobin.core.jrrd.Constants
CF_NAM_SIZE, COOKIE, DS_NAM_SIZE, DST_SIZE, FLOAT_COOKIE, FLOAT_COOKIE_BIG_ENDIAN, FLOAT_COOKIE_LITTLE_ENDIAN, LAST_DS_LEN, VERSION, VERSION3
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intalign()(package private) intalign(int boundary)(package private) voidclose()(package private) intgetAlignment()(package private) longgetFilePointer()(package private) longinfo()(package private) booleanisBigEndian()(package private) doublereadDouble()(package private) intreadInt()(package private) intreadInt(boolean dump)Reads the next integer (4 or 8 bytes depending on alignment), advancing the file pointer and returns it If the alignment is 8-bytes (64-bit), then 8 bytes are read, but only the lower 4-bytes (32-bits) are returned.(package private) StringreadString(int maxLength)(package private) voidskipBytes(int n)
-
-
-
Field Detail
-
bigEndian
boolean bigEndian
-
debug
boolean debug
-
alignment
int alignment
-
ras
RandomAccessFile ras
-
buffer
byte[] buffer
-
-
Constructor Detail
-
RRDFile
RRDFile(String name) throws IOException, RrdException
- Throws:
IOExceptionRrdException
-
RRDFile
RRDFile(File file) throws IOException, RrdException
- Throws:
IOExceptionRrdException
-
-
Method Detail
-
isBigEndian
boolean isBigEndian()
-
getAlignment
int getAlignment()
-
readDouble
double readDouble() throws IOException, RrdException- Throws:
IOExceptionRrdException
-
readInt
int readInt() throws IOException, RrdException- Throws:
IOExceptionRrdException
-
readInt
int readInt(boolean dump) throws IOException, RrdExceptionReads the next integer (4 or 8 bytes depending on alignment), advancing the file pointer and returns it If the alignment is 8-bytes (64-bit), then 8 bytes are read, but only the lower 4-bytes (32-bits) are returned. The upper 4 bytes are ignored.- Returns:
- the 32-bit integer read from the file
- Throws:
IOException- - A file access errorRrdException- - Not enough bytes were left in the file to read the integer.
-
readString
String readString(int maxLength) throws IOException, RrdException
- Throws:
IOExceptionRrdException
-
skipBytes
void skipBytes(int n) throws IOException- Throws:
IOException
-
align
int align(int boundary) throws IOException
- Throws:
IOException
-
align
int align() throws IOException
- Throws:
IOException
-
info
long info() throws IOException
- Throws:
IOException
-
getFilePointer
long getFilePointer() throws IOException- Throws:
IOException
-
close
void close() throws IOException- Throws:
IOException
-
-