Path: blob/master/src/java.base/share/classes/jdk/internal/misc/FileSystemOption.java
41159 views
/*1* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package jdk.internal.misc;2627import sun.nio.fs.ExtendedOptions;2829import java.nio.file.CopyOption;30import java.nio.file.OpenOption;31import java.nio.file.WatchEvent;3233/**34* Internal file system options for jdk.unsupported com.sun.nio.file API use.35*/36public final class FileSystemOption<T> {37public static final FileSystemOption<Void> INTERRUPTIBLE =38new FileSystemOption<>(ExtendedOptions.INTERRUPTIBLE);39public static final FileSystemOption<Void> NOSHARE_READ =40new FileSystemOption<>(ExtendedOptions.NOSHARE_READ);41public static final FileSystemOption<Void> NOSHARE_WRITE =42new FileSystemOption<>(ExtendedOptions.NOSHARE_WRITE);43public static final FileSystemOption<Void> NOSHARE_DELETE =44new FileSystemOption<>(ExtendedOptions.NOSHARE_DELETE);45public static final FileSystemOption<Void> FILE_TREE =46new FileSystemOption<>(ExtendedOptions.FILE_TREE);47public static final FileSystemOption<Void> DIRECT =48new FileSystemOption<>(ExtendedOptions.DIRECT);49public static final FileSystemOption<Integer> SENSITIVITY_HIGH =50new FileSystemOption<>(ExtendedOptions.SENSITIVITY_HIGH);51public static final FileSystemOption<Integer> SENSITIVITY_MEDIUM =52new FileSystemOption<>(ExtendedOptions.SENSITIVITY_MEDIUM);53public static final FileSystemOption<Integer> SENSITIVITY_LOW =54new FileSystemOption<>(ExtendedOptions.SENSITIVITY_LOW);5556private final ExtendedOptions.InternalOption<T> internalOption;57private FileSystemOption(ExtendedOptions.InternalOption<T> option) {58this.internalOption = option;59}6061/**62* Register this internal option as an OpenOption.63*/64public void register(OpenOption option) {65internalOption.register(option);66}6768/**69* Register this internal option as a CopyOption.70*/71public void register(CopyOption option) {72internalOption.register(option);73}7475/**76* Register this internal option as a WatchEvent.Modifier.77*/78public void register(WatchEvent.Modifier option) {79internalOption.register(option);80}8182/**83* Register this internal option as a WatchEvent.Modifier with the84* given parameter.85*/86public void register(WatchEvent.Modifier option, T param) {87internalOption.register(option, param);88}89}909192