public synchronized int copyDirect(int pageId,OutputStream out) throws IOException {
  byte[] buffer=new byte[pageSize];
  if (pageId >= pageCount) {
    return -1;
  }
  file.seek((long)pageId << pageSizeShift);
  file.readFullyDirect(buffer,0,pageSize);
  readCount++;
  out.write(buffer,0,pageSize);
  return pageId + 1;
}

public synchronized int copyDirect ( int pageId , OutputStream out ) throws IOException { byte [ ] buffer = new byte [ pageSize ] ; if ( pageId >= pageCount ) { return - 1 ; } file . seek ( ( long ) pageId << pageSizeShift ) ; file . readFullyDirect ( buffer , 0 , pageSize ) ; readCount ++ ; out . write ( buffer , 0 , pageSize ) ; return pageId + 1 ; }
copy the next page to the output stream .
