public static void dumpCurrentRow ( Cursor cursor , PrintStream stream ) { String [ ] cols = cursor . getColumnNames ( ) ; stream . println ( "" + cursor . getPosition ( ) + " {" ) ; int length = cols . length ; for ( int i = 0 ; i < length ; i ++ ) { String value ; try { value = cursor . getString ( i ) ; } catch ( SQLiteException e ) { // assume that if the getString threw this exception then the column is not // representable by a string, e.g. it is a BLOB. value = "<unprintable>" ; } stream . println ( " " + cols [ i ] + ' ' + value ) ; } stream . println ( "}" ) ; }
Prints the contents of a Cursor s current row to a PrintSteam .