private void writeSymbolsField ( SymbolTable symTab ) { // SymbolTable's APIs doesn't expose an Iterator to traverse declared // symbol strings in reverse order. As such, we utilize these two // indexes to traverse the strings in reverse. int importedMaxId = symTab . getImportedMaxId ( ) ; int maxId = symTab . getMaxId ( ) ; if ( importedMaxId == maxId ) { // There are no declared local symbols return ; } final int originalOffset = myBuffer . length - myOffset ; for ( int i = maxId ; i > importedMaxId ; i -- ) { String str = symTab . findKnownSymbol ( i ) ; if ( str == null ) { writeByte ( ( byte ) ( TYPE_STRING | NULL_LENGTH_MASK ) ) ; } else { writeIonStringContent ( str ) ; } } writePrefix ( TYPE_LIST , myBuffer . length - myOffset - originalOffset ) ; writeByte ( ( byte ) ( 0x80 | SYMBOLS_SID ) ) ; }
Write declared local symbol names if any exists .