public static final int getTotalCapacity ( WsByteBuffer [ ] list ) { if ( null == list ) { return 0 ; } int cap = 0 ; for ( int i = 0 ; i < list . length ; i ++ ) { if ( list [ i ] != null ) { cap += list [ i ] . capacity ( ) ; } } return cap ; }
Find out the total capacity in an array of buffers . A null or empty list will return 0 .