public int estimateSize ( Object message ) { if ( message == null ) { return 8 ; } int answer = 8 + estimateSize ( message . getClass ( ) , null ) ; if ( message instanceof IoBuffer ) { answer += ( ( IoBuffer ) message ) . remaining ( ) ; } else if ( message instanceof WriteRequest ) { answer += estimateSize ( ( ( WriteRequest ) message ) . getMessage ( ) ) ; } else if ( message instanceof CharSequence ) { answer += ( ( CharSequence ) message ) . length ( ) << 1 ; } else if ( message instanceof Iterable ) { for ( Object m : ( Iterable < ? > ) message ) { answer += estimateSize ( m ) ; } } return align ( answer ) ; }
Estimate the size of an Objecr in number of bytes