Java Code Examples for com.sun.nio.file.ExtendedOpenOption

The following examples show how to use com.sun.nio.file.ExtendedOpenOption. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 2
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 3
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 4
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 5
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 6
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 7
Source Project: hottub   Source File: WindowsChannelFactory.java    License: GNU General Public License v2.0 4 votes vote down vote up
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 8
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 9
Source Project: herddb   Source File: OpenFileUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static FileChannel openFileChannelWithO_DIRECT(Path path, OpenOption... options) throws IOException {
    OpenOption[] options2 = new OpenOption[options.length + 1];
    System.arraycopy(options, 0, options2, 0, options.length);
    options2[options2.length - 1] = ExtendedOpenOption.DIRECT;
    return FileChannel.open(path, options2);
}
 
Example 10
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 11
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 12
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}
 
Example 13
static Flags toFlags(Set<? extends OpenOption> options) {
    Flags flags = new Flags();
    for (OpenOption option: options) {
        if (option instanceof StandardOpenOption) {
            switch ((StandardOpenOption)option) {
                case READ : flags.read = true; break;
                case WRITE : flags.write = true; break;
                case APPEND : flags.append = true; break;
                case TRUNCATE_EXISTING : flags.truncateExisting = true; break;
                case CREATE : flags.create = true; break;
                case CREATE_NEW : flags.createNew = true; break;
                case DELETE_ON_CLOSE : flags.deleteOnClose = true; break;
                case SPARSE : flags.sparse = true; break;
                case SYNC : flags.sync = true; break;
                case DSYNC : flags.dsync = true; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option instanceof ExtendedOpenOption) {
            switch ((ExtendedOpenOption)option) {
                case NOSHARE_READ : flags.shareRead = false; break;
                case NOSHARE_WRITE : flags.shareWrite = false; break;
                case NOSHARE_DELETE : flags.shareDelete = false; break;
                default: throw new UnsupportedOperationException();
            }
            continue;
        }
        if (option == LinkOption.NOFOLLOW_LINKS) {
            flags.noFollowLinks = true;
            continue;
        }
        if (option == OPEN_REPARSE_POINT) {
            flags.openReparsePoint = true;
            continue;
        }
        if (option == null)
            throw new NullPointerException();
        throw new UnsupportedOperationException();
    }
    return flags;
}