/[classpath]/classpath/gnu/java/nio/channels/FileChannelImpl.java
ViewVC logotype

Diff of /classpath/gnu/java/nio/channels/FileChannelImpl.java

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

revision 1.10 by tromey, Tue Apr 26 21:46:50 2005 UTC revision 1.11 by mark, Fri Apr 29 16:57:05 2005 UTC
# Line 41  package gnu.java.nio.channels; Line 41  package gnu.java.nio.channels;
41  import gnu.classpath.Configuration;  import gnu.classpath.Configuration;
42  import gnu.java.nio.FileLockImpl;  import gnu.java.nio.FileLockImpl;
43    
44    import java.io.File;
45  import java.io.FileNotFoundException;  import java.io.FileNotFoundException;
46  import java.io.IOException;  import java.io.IOException;
47  import java.nio.ByteBuffer;  import java.nio.ByteBuffer;
# Line 101  public final class FileChannelImpl exten Line 102  public final class FileChannelImpl exten
102    }    }
103    
104    /* Open a file.  MODE is a combination of the above mode flags. */    /* Open a file.  MODE is a combination of the above mode flags. */
105    public FileChannelImpl (String path, int mode) throws FileNotFoundException    public FileChannelImpl (File file, int mode) throws FileNotFoundException
106    {    {
107        final String path = file.getPath();
108      fd = open (path, mode);      fd = open (path, mode);
109      this.mode = mode;      this.mode = mode;
110    
111        // First open the file and then check if it is a a directory
112        // to avoid race condition.
113        if (file.isDirectory())
114          {
115            try
116              {
117                  close();
118              }
119            catch (IOException e)
120              {
121                  /* ignore it */
122              }
123    
124            throw new FileNotFoundException(path + " is a directory");
125          }
126    }    }
127    
128    /* Used by init() (native code) */    /* Used by init() (native code) */

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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