56 |
{ |
{ |
57 |
private FileDescriptor fd; |
private FileDescriptor fd; |
58 |
|
|
59 |
|
private FileChannel ch; /* cached associated file-channel */ |
60 |
|
|
61 |
/** |
/** |
62 |
* Whether or not this file is open in read only mode |
* Whether or not this file is open in read only mode |
63 |
*/ |
*/ |
1085 |
* A file channel must be created by first creating an instance of |
* A file channel must be created by first creating an instance of |
1086 |
* Input/Output/RandomAccessFile and invoking the getChannel() method on it. |
* Input/Output/RandomAccessFile and invoking the getChannel() method on it. |
1087 |
*/ |
*/ |
1088 |
|
public synchronized FileChannel getChannel() |
|
private FileChannel ch; /* cached associated file-channel */ |
|
|
|
|
|
public FileChannel getChannel() |
|
1089 |
{ |
{ |
1090 |
synchronized (this) |
if (ch == null) |
1091 |
{ |
ch = new FileChannelImpl ((int) (fd.getNativeFd() & 0xFFFF), this); |
1092 |
// FIXME: Need to convert NIO to 64 bit |
|
1093 |
if (ch == null) |
return ch; |
|
ch = new gnu.java.nio.FileChannelImpl( |
|
|
(int)(fd.getNativeFd() & 0xFFFF), this); |
|
|
} |
|
|
return ch; |
|
1094 |
} |
} |
1095 |
|
|
1096 |
} // class RandomAccessFile |
} // class RandomAccessFile |