|
From: <sa...@us...> - 2003-11-27 11:21:25
|
Update of /cvsroot/jrobin/src/org/jrobin/core
In directory sc8-pr-cvs1:/tmp/cvs-serv14259/org/jrobin/core
Modified Files:
RrdPrimitive.java
Log Message:
Related classes (RrdInt, RrdLong, etc) are now properly rooted. RrdPrimtive class introduced as a base class for all classes mapped to a RRD file. Code should run slightly faster.
Index: RrdPrimitive.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdPrimitive.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RrdPrimitive.java 27 Nov 2003 10:22:58 -0000 1.1
--- RrdPrimitive.java 27 Nov 2003 11:21:22 -0000 1.2
***************
*** 65,69 ****
byte[] getBytes() throws IOException {
byte[] b = new byte[byteCount];
! int bytesRead = parent.getRrdFile().read(b);
if(bytesRead != byteCount) {
throw new IOException("Could not read enough bytes (" + byteCount +
--- 65,71 ----
byte[] getBytes() throws IOException {
byte[] b = new byte[byteCount];
! RrdFile rrdFile = getRrdFile();
! rrdFile.seek(pointer);
! int bytesRead = rrdFile.read(b);
if(bytesRead != byteCount) {
throw new IOException("Could not read enough bytes (" + byteCount +
***************
*** 72,75 ****
return b;
}
!
}
--- 74,87 ----
return b;
}
!
! void writeBytes(byte[] b) throws IOException {
! if(b.length != byteCount) {
! throw new IOException("Invalid number of bytes supplied (" + b.length +
! "), exactly " + byteCount + " needed");
! }
! RrdFile rrdFile = getRrdFile();
! rrdFile.seek(pointer);
! rrdFile.write(b);
! }
!
}
|