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) int
alignment
(package private) boolean
bigEndian
(package private) byte[]
buffer
(package private) boolean
debug
(package private) RandomAccessFile
ras
-
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) int
align()
(package private) int
align(int boundary)
(package private) void
close()
(package private) int
getAlignment()
(package private) long
getFilePointer()
(package private) long
info()
(package private) boolean
isBigEndian()
(package private) double
readDouble()
(package private) int
readInt()
(package private) int
readInt(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) String
readString(int maxLength)
(package private) void
skipBytes(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:
IOException
RrdException
-
RRDFile
RRDFile(File file) throws IOException, RrdException
- Throws:
IOException
RrdException
-
-
Method Detail
-
isBigEndian
boolean isBigEndian()
-
getAlignment
int getAlignment()
-
readDouble
double readDouble() throws IOException, RrdException
- Throws:
IOException
RrdException
-
readInt
int readInt() throws IOException, RrdException
- Throws:
IOException
RrdException
-
readInt
int readInt(boolean dump) throws IOException, RrdException
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. 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:
IOException
RrdException
-
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
-
-