protected static void writeDataPage(ByteBuffer buffer,DataPage dataPage,int tdefPageNumber,JetFormat format) throws IOException {
  buffer.put(dataPage.isLeaf() ? PageTypes.INDEX_LEAF : PageTypes.INDEX_NODE);
  buffer.put((byte)0x01);
  buffer.putShort((short)0);
  buffer.putInt(tdefPageNumber);
  buffer.putInt(0);
  buffer.putInt(dataPage.getPrevPageNumber());
  buffer.putInt(dataPage.getNextPageNumber());
  buffer.putInt(dataPage.getChildTailPageNumber());
  byte[] entryPrefix=dataPage.getEntryPrefix();
  buffer.putShort((short)entryPrefix.length);
  buffer.put((byte)0);
  byte[] entryMask=new byte[format.SIZE_INDEX_ENTRY_MASK];
  int totalSize=entryPrefix.length;
  for (  Entry entry : dataPage.getEntries()) {
    totalSize+=(entry.size() - entryPrefix.length);
    int idx=totalSize / 8;
    entryMask[idx]|=(1 << (totalSize % 8));
  }
  buffer.put(entryMask);
  buffer.put(entryPrefix);
  for (  Entry entry : dataPage.getEntries()) {
    entry.write(buffer,entryPrefix);
  }
  buffer.putShort(2,(short)(format.PAGE_SIZE - buffer.position()));
}

protected static void writeDataPage ( ByteBuffer buffer , DataPage dataPage , int tdefPageNumber , JetFormat format ) throws IOException { buffer . put ( dataPage . isLeaf ( ) ? PageTypes . INDEX_LEAF : PageTypes . INDEX_NODE ) ; buffer . put ( ( byte ) 0x01 ) ; buffer . putShort ( ( short ) 0 ) ; buffer . putInt ( tdefPageNumber ) ; buffer . putInt ( 0 ) ; buffer . putInt ( dataPage . getPrevPageNumber ( ) ) ; buffer . putInt ( dataPage . getNextPageNumber ( ) ) ; buffer . putInt ( dataPage . getChildTailPageNumber ( ) ) ; byte [ ] entryPrefix = dataPage . getEntryPrefix ( ) ; buffer . putShort ( ( short ) entryPrefix . length ) ; buffer . put ( ( byte ) 0 ) ; byte [ ] entryMask = new byte [ format . SIZE_INDEX_ENTRY_MASK ] ; int totalSize = entryPrefix . length ; for ( Entry entry : dataPage . getEntries ( ) ) { totalSize += ( entry . size ( ) - entryPrefix . length ) ; int idx = totalSize / 8 ; entryMask [ idx ] |= ( 1 << ( totalSize % 8 ) ) ; } buffer . put ( entryMask ) ; buffer . put ( entryPrefix ) ; for ( Entry entry : dataPage . getEntries ( ) ) { entry . write ( buffer , entryPrefix ) ; } buffer . putShort ( 2 , ( short ) ( format . PAGE_SIZE - buffer . position ( ) ) ) ; }
writes the data page info to the given buffer .
