* @throws java.io.IOException if there is an exception during IO
*/
public static ChannelDescriptor open(String cwd, String path, ModeFlags flags, int perm, POSIX posix, ClassLoader classLoader) throws FileNotFoundException, DirectoryAsFileException, FileExistsException, IOException {
boolean fileCreated = false;
if (path.equals("/dev/null") || path.equalsIgnoreCase("nul:") || path.equalsIgnoreCase("nul")) {
Channel nullChannel = new NullChannel();
// FIXME: don't use RubyIO for this
return new ChannelDescriptor(nullChannel, flags);
} else if (path.startsWith("file:")) {
int bangIndex = path.indexOf("!");
if (bangIndex > 0) {