private void appendFileDetails ( final StringBuffer buf , final WMultiFileWidget fileWidget ) { List < FileWidgetUpload > files = fileWidget . getFiles ( ) ; if ( files != null ) { for ( FileWidgetUpload file : files ) { String streamedSize ; try { InputStream in = file . getFile ( ) . getInputStream ( ) ; int size = 0 ; while ( in . read ( ) >= 0 ) { size ++ ; } streamedSize = String . valueOf ( size ) ; } catch ( IOException e ) { streamedSize = e . getMessage ( ) ; } buf . append ( "Name: " ) . append ( file . getFile ( ) . getName ( ) ) ; buf . append ( "\nSize: " ) . append ( streamedSize ) . append ( " bytes\n\n" ) ; } } }
Appends details of the uploaded files to the given string buffer .