/[classpath]/classpath/java/io/FileOutputStream.java
ViewVC logotype

Diff of /classpath/java/io/FileOutputStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by mkoch, Sun Mar 23 10:53:30 2003 UTC revision 1.18 by mkoch, Sun Mar 23 11:54:44 2003 UTC
# Line 52  public class FileOutputStream extends Ou Line 52  public class FileOutputStream extends Ou
52  {  {
53    private FileDescriptor fd;    private FileDescriptor fd;
54    
55      private FileChannel ch; /* cached associated file-channel */
56    
57    /**    /**
58     * This method initializes a <code>FileOutputStream</code> object to write     * This method initializes a <code>FileOutputStream</code> object to write
59     * to the named file.  The file is created if it does not exist, and     * to the named file.  The file is created if it does not exist, and
# Line 258  public class FileOutputStream extends Ou Line 260  public class FileOutputStream extends Ou
260    }    }
261    
262    /**    /**
263     *  This method creates a java.nio.channels.FileChannel.     * This method creates a java.nio.channels.FileChannel.
264     * Nio does not allow one to create a file channel directly.     * Nio does not allow one to create a file channel directly.
265     * A file channel must be created by first creating an instance of     * A file channel must be created by first creating an instance of
266     * Input/Output/RandomAccessFile and invoking the getChannel() method on it.     * Input/Output/RandomAccessFile and invoking the getChannel() method on it.
267     */     */
268      public synchronized FileChannel getChannel()
   private FileChannel ch; /* cached associated file-channel */  
   
   public FileChannel  
   getChannel()  
269    {    {
270        synchronized (this)      if (ch == null)
271          {        ch = new FileChannelImpl ((int) (fd.getNativeFd() & 0xFFFF), this);
272              // FIXME:  Convert NIO to 64 bit  
273              if (ch == null)      return ch;
                 ch = new gnu.java.nio.FileChannelImpl(  
                     (int)(fd.getNativeFd() & 0xFFFF), this);  
         }  
       return ch;  
274    }    }
275    
276  } // class FileOutputStream  } // class FileOutputStream

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26