public void writeToTable ( ) { // [START bigtable_hw_write_rows_veneer] try { System . out . println ( "\nWriting some greetings to the table" ) ; String [ ] greetings = { "Hello World!" , "Hello Bigtable!" , "Hello Java!" } ; for ( int i = 0 ; i < greetings . length ; i ++ ) { RowMutation rowMutation = RowMutation . create ( tableId , ROW_KEY_PREFIX + i ) . setCell ( COLUMN_FAMILY , COLUMN_QUALIFIER , greetings [ i ] ) ; dataClient . mutateRow ( rowMutation ) ; System . out . println ( greetings [ i ] ) ; } } catch ( NotFoundException e ) { System . err . println ( "Failed to write to non-existent table: " + e . getMessage ( ) ) ; } // [END bigtable_hw_write_rows_veneer] }
Demonstrates how to write some rows to a table .