src/share/classes/java/io/FileOutputStream.java

Print this page
rev 10457 : 8054720: Modifications of I/O methods for instrumentation purposes
Summary: Wrap some native methods in Java methods and change native method names to a consistent form.
Reviewed-by: TBD


 239     public FileOutputStream(FileDescriptor fdObj) {
 240         SecurityManager security = System.getSecurityManager();
 241         if (fdObj == null) {
 242             throw new NullPointerException();
 243         }
 244         if (security != null) {
 245             security.checkWrite(fdObj);
 246         }
 247         this.fd = fdObj;
 248         this.append = false;
 249         this.path = null;
 250 
 251         fd.attach(this);
 252     }
 253 
 254     /**
 255      * Opens a file, with the specified name, for overwriting or appending.
 256      * @param name name of file to be opened
 257      * @param append whether the file is to be opened in append mode
 258      */
 259     private native void open(String name, boolean append)









 260         throws FileNotFoundException;
 261 
 262     /**
 263      * Writes the specified byte to this file output stream.
 264      *
 265      * @param   b   the byte to be written.
 266      * @param   append   {@code true} if the write operation first
 267      *     advances the position to the end of file
 268      */
 269     private native void write(int b, boolean append) throws IOException;
 270 
 271     /**
 272      * Writes the specified byte to this file output stream. Implements
 273      * the <code>write</code> method of <code>OutputStream</code>.
 274      *
 275      * @param      b   the byte to be written.
 276      * @exception  IOException  if an I/O error occurs.
 277      */
 278     public void write(int b) throws IOException {
 279         write(b, append);




 239     public FileOutputStream(FileDescriptor fdObj) {
 240         SecurityManager security = System.getSecurityManager();
 241         if (fdObj == null) {
 242             throw new NullPointerException();
 243         }
 244         if (security != null) {
 245             security.checkWrite(fdObj);
 246         }
 247         this.fd = fdObj;
 248         this.append = false;
 249         this.path = null;
 250 
 251         fd.attach(this);
 252     }
 253 
 254     /**
 255      * Opens a file, with the specified name, for overwriting or appending.
 256      * @param name name of file to be opened
 257      * @param append whether the file is to be opened in append mode
 258      */
 259     private void open(String name, boolean append) throws FileNotFoundException {
 260         open0(name, append);
 261     }
 262 
 263     /**
 264      * Opens a file, with the specified name, for overwriting or appending.
 265      * @param name name of file to be opened
 266      * @param append whether the file is to be opened in append mode
 267      */
 268     private native void open0(String name, boolean append)
 269         throws FileNotFoundException;
 270 
 271     /**
 272      * Writes the specified byte to this file output stream.
 273      *
 274      * @param   b   the byte to be written.
 275      * @param   append   {@code true} if the write operation first
 276      *     advances the position to the end of file
 277      */
 278     private native void write(int b, boolean append) throws IOException;
 279 
 280     /**
 281      * Writes the specified byte to this file output stream. Implements
 282      * the <code>write</code> method of <code>OutputStream</code>.
 283      *
 284      * @param      b   the byte to be written.
 285      * @exception  IOException  if an I/O error occurs.
 286      */
 287     public void write(int b) throws IOException {
 288         write(b, append);