static FileOutputStream createFileOutputStream(final File file, final boolean append) throws IOException
	{
		try {
			FileOutputStream fs = getInstance().doPrivileged(
					new PrivilegedExceptionAction<FileOutputStream>() {
						public FileOutputStream run() throws IOException {
							if (file instanceof GenericOutputFile) {
								return ((GenericOutputFile)file).createOutputStream(append);
							} else {
								return new FileOutputStream(file, append);
							}
						}
					}
			);
			return fs;
		}
		catch (PrivilegedActionException ex) {
			throw new IOException("Unable to create FileOutputStream over file "+file.getName(), ex);
		}
	}
static FileOutputStream createFileOutputStream ( final File file , final boolean append ) throws IOException { try { FileOutputStream fs = getInstance ( ) . doPrivileged ( new PrivilegedExceptionAction < FileOutputStream > ( ) { public FileOutputStream run ( ) throws IOException { if ( file instanceof GenericOutputFile ) { return ( ( GenericOutputFile ) file ) . createOutputStream ( append ) ; } else { return new FileOutputStream ( file , append ) ; } } } ) ; return fs ; } catch ( PrivilegedActionException ex ) { throw new IOException ( "Unable to create FileOutputStream over file " + file . getName ( ) , ex ) ; } }
Using privileged security, create a <code>FileOutputStream</code> over the
specified file, using the appropriate truncate/append semantics.
<p>
@param file the name of the file. The caller must guarantee this is non-null
@param append if true, append to the file if it exists, if false, truncate
the file (this is the default behavior).
@return a FileOutputStream object
@exception IOException an exception was encountered while attempting to create
the FileOutputStream.