public TableReader read ( ) throws IOException { int tableHeader = m_stream . readInt ( ) ; if ( tableHeader != 0x39AF547A ) { throw new IllegalArgumentException ( "Unexpected file format" ) ; } int recordCount = m_stream . readInt ( ) ; for ( int loop = 0 ; loop < recordCount ; loop ++ ) { int rowMagicNumber = m_stream . readInt ( ) ; if ( rowMagicNumber != rowMagicNumber ( ) ) { throw new IllegalArgumentException ( "Unexpected file format" ) ; } // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map < String , Object > map = new LinkedHashMap < String , Object > ( ) ; if ( hasUUID ( ) ) { readUUID ( m_stream , map ) ; } readRow ( m_stream , map ) ; SynchroLogger . log ( "READER" , getClass ( ) , map ) ; m_rows . add ( new MapRow ( map ) ) ; } int tableTrailer = m_stream . readInt ( ) ; if ( tableTrailer != 0x6F99E416 ) { throw new IllegalArgumentException ( "Unexpected file format" ) ; } postTrailer ( m_stream ) ; return this ; }
Read data from the table . Return a reference to the current instance to allow method chaining .