private void actionAppend ( ) throws PageException { if ( output == null ) throw new ApplicationException ( "attribute output is not defined for tag file" ) ; checkFile ( pageContext , securityManager , file , serverPassword , createPath , true , false , true ) ; setACL ( pageContext , file , acl ) ; try { if ( ! file . exists ( ) ) file . createNewFile ( ) ; String content = Caster . toString ( output ) ; if ( fixnewline ) content = doFixNewLine ( content ) ; if ( addnewline ) content += SystemUtil . getOSSpecificLineSeparator ( ) ; IOUtil . write ( file , content , CharsetUtil . toCharset ( charset ) , true ) ; } catch ( UnsupportedEncodingException e ) { throw new ApplicationException ( "Unsupported Charset Definition [" + charset + "]" , e . getMessage ( ) ) ; } catch ( IOException e ) { throw new ApplicationException ( "can't write file" , e . getMessage ( ) ) ; } setMode ( file , mode ) ; setAttributes ( file , attributes ) ; }
append data to source file