FileDocCategorySizeDatePackage
FileChannelFactory.javaAPI DocAndroid 1.5 API2223Wed May 06 22:41:04 BST 2009org.apache.harmony.nio

FileChannelFactory

public class FileChannelFactory extends Object
A simple factory to provide a generic way to create FileChannel implementation from within the java.io package.

Fields Summary
Constructors Summary
Methods Summary
public static java.nio.channels.FileChannelgetFileChannel(java.lang.Object stream, int fd, int mode)

        switch(mode){
        case IFileSystem.O_RDONLY:
            return new ReadOnlyFileChannel(stream, fd);
        case IFileSystem.O_WRONLY:
            return new WriteOnlyFileChannel(stream, fd);
        case IFileSystem.O_RDWR:
            return new ReadWriteFileChannel(stream, fd);
        case IFileSystem.O_RDWRSYNC:
            return new ReadWriteFileChannel(stream, fd);
        case IFileSystem.O_APPEND:
            return new WriteOnlyFileChannel(stream, fd, true);
        default:
            // nio.09=Unknown file channel type: {0}
            throw new RuntimeException(Messages.getString("nio.09", mode));  //$NON-NLS-1$
        }