private void readPage ( byte [ ] buffer , Table table ) { int magicNumber = getShort ( buffer , 0 ) ; if ( magicNumber == 0x4400 ) { //System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, "")); int recordSize = m_definition . getRecordSize ( ) ; RowValidator rowValidator = m_definition . getRowValidator ( ) ; String primaryKeyColumnName = m_definition . getPrimaryKeyColumnName ( ) ; int index = 6 ; while ( index + recordSize <= buffer . length ) { //System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, "")); int btrieveValue = getShort ( buffer , index ) ; if ( btrieveValue != 0 ) { Map < String , Object > row = new HashMap < String , Object > ( ) ; row . put ( "ROW_VERSION" , Integer . valueOf ( btrieveValue ) ) ; for ( ColumnDefinition column : m_definition . getColumns ( ) ) { Object value = column . read ( index , buffer ) ; //System.out.println(column.getName() + ": " + value); row . put ( column . getName ( ) , value ) ; } if ( rowValidator == null || rowValidator . validRow ( row ) ) { table . addRow ( primaryKeyColumnName , row ) ; } } index += recordSize ; } } }
Reads data from a single page of the database file .