public static < T , U extends T > int safeWrite ( ArrayWritable < U > aw , T [ ] array ) { int num = aw . size ( ) ; if ( num <= 0 ) { return 0 ; } if ( num > array . length ) { num = array . length ; } aw . writeToArray ( 0 , array , 0 , num ) ; return num ; }
Writes the complete container data to an array . This method ensures that the array s capacity is not exceeded .