39 |
package java.io; |
package java.io; |
40 |
|
|
41 |
import gnu.classpath.Configuration; |
import gnu.classpath.Configuration; |
42 |
|
import java.nio.channels.FileChannel; |
43 |
|
import gnu.java.nio.FileChannelImpl; |
44 |
|
|
45 |
/** |
/** |
46 |
* This classes allows a stream of data to be written to a disk file or |
* This classes allows a stream of data to be written to a disk file or |
355 |
close(); |
close(); |
356 |
} |
} |
357 |
|
|
358 |
|
/*************************************************************************/ |
359 |
|
|
360 |
|
/** |
361 |
|
* This method creates a java.nio.channels.FileChannel. |
362 |
|
* Nio does not allow one to create a file channel directly. |
363 |
|
* A file channel must be created by first creating an instance of |
364 |
|
* Input/Output/RandomAccessFile and invoking the getChannel() method on it. |
365 |
|
*/ |
366 |
|
|
367 |
|
private FileChannel ch; /* cached associated file-channel */ |
368 |
|
|
369 |
|
public FileChannel |
370 |
|
getChannel() |
371 |
|
{ |
372 |
|
synchronized (this) |
373 |
|
{ |
374 |
|
if (ch == null) |
375 |
|
ch = new gnu.java.nio.FileChannelImpl(native_fd, |
376 |
|
this); |
377 |
|
} |
378 |
|
return ch; |
379 |
|
} |
380 |
|
|
381 |
|
|
382 |
} // class FileOutputStream |
} // class FileOutputStream |
383 |
|
|