private void put ( PrintStream p , String s , int column , int colSpan , BandElement bandElement ) { if ( s == null ) { // nl(); put ( p , "" , column , colSpan , bandElement ) ; return ; } int size = 0 ; if ( colSpan > 1 ) { for ( int i = column ; i < column + colSpan ; i ++ ) { size += columnWidth [ i ] ; } } else { size = columnWidth [ column ] ; } if ( ( bandElement != null ) && bandElement . getHorizontalAlign ( ) == BandElement . RIGHT ) { p . print ( String . format ( "%" + size + "s" , s ) ) ; } else { p . print ( String . format ( "%-" + size + "s" , s ) ) ; } }
Write one tsv field to the file followed by a separator unless it is the last field on the line . Lead and trailing blanks will be removed .