Ejemplo n.º 1
0
 /**
  * read the header and used data portion from IoInterface implementor
  *
  * @param fobj the IoInterface
  * @exception IOException error reading field
  */
 public synchronized void readUsed(IoInterface fobj) throws IOException {
   // synchronized(fobj) {
   setPrevblk(fobj.Fread_long());
   setNextblk(fobj.Fread_long());
   setBytesused(fobj.Fread_short());
   setBytesinuse(fobj.Fread_short());
   setPageLSN(fobj.Fread_long());
   if (getBytesused() > datasize) {
     throw new IOException("block inconsistency " + this.toString());
   }
   if (getBytesused() == datasize) {
     if (fobj.Fread(data) != datasize) {
       throw new IOException("Datablock read size invalid " + this.toString());
     }
   } else {
     if (fobj.Fread(data, getBytesused()) != getBytesused()) {
       throw new IOException(
           "Datablock read error bytesused="
               + String.valueOf(getBytesused())
               + " bytesinuse="
               + String.valueOf(getBytesinuse()));
     }
   }
   // }
 }
Ejemplo n.º 2
0
 /**
  * read the header and data portion from IoInterface implementor
  *
  * @param fobj the IoInterface
  * @exception IOException error reading field
  */
 public synchronized void read(IoInterface fobj) throws IOException {
   // synchronized(fobj) {
   setPrevblk(fobj.Fread_long());
   setNextblk(fobj.Fread_long());
   setBytesused(fobj.Fread_short());
   setBytesinuse(fobj.Fread_short());
   setPageLSN(fobj.Fread_long());
   if (fobj.Fread(data, datasize) != datasize) {
     throw new IOException("Datablock read size invalid " + this.toString());
   }
   // }
 }