893N/A/*
3909N/A * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
893N/A *
893N/A * This code is free software; you can redistribute it and/or modify it
893N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
893N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
893N/A *
893N/A * This code is distributed in the hope that it will be useful, but WITHOUT
893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
893N/A * version 2 for more details (a copy is included in the LICENSE file that
893N/A * accompanied this code).
893N/A *
893N/A * You should have received a copy of the GNU General Public License version
893N/A * 2 along with this work; if not, write to the Free Software Foundation,
893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
893N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
893N/A */
893N/A
893N/Apackage sun.nio.fs;
893N/A
3471N/Aimport java.nio.file.*;
3471N/Aimport java.nio.file.attribute.*;
5316N/Aimport java.nio.file.spi.FileTypeDetector;
3471N/Aimport java.io.IOException;
3471N/A
893N/A/**
893N/A * Linux implementation of FileSystemProvider
893N/A */
893N/A
893N/Apublic class LinuxFileSystemProvider extends UnixFileSystemProvider {
893N/A public LinuxFileSystemProvider() {
893N/A super();
893N/A }
893N/A
893N/A @Override
893N/A LinuxFileSystem newFileSystem(String dir) {
893N/A return new LinuxFileSystem(this, dir);
893N/A }
3471N/A
3471N/A @Override
3471N/A LinuxFileStore getFileStore(UnixPath path) throws IOException {
3471N/A return new LinuxFileStore(path);
3471N/A }
3471N/A
3471N/A @Override
3471N/A @SuppressWarnings("unchecked")
3471N/A public <V extends FileAttributeView> V getFileAttributeView(Path obj,
3471N/A Class<V> type,
3471N/A LinkOption... options)
3471N/A {
3471N/A if (type == DosFileAttributeView.class) {
3471N/A return (V) new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj),
3899N/A Util.followLinks(options));
3471N/A }
3471N/A if (type == UserDefinedFileAttributeView.class) {
3471N/A return (V) new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
3899N/A Util.followLinks(options));
3471N/A }
3471N/A return super.getFileAttributeView(obj, type, options);
3471N/A }
3471N/A
3471N/A @Override
3471N/A public DynamicFileAttributeView getFileAttributeView(Path obj,
3471N/A String name,
3471N/A LinkOption... options)
3471N/A {
3471N/A if (name.equals("dos")) {
3471N/A return new LinuxDosFileAttributeView(UnixPath.toUnixPath(obj),
3899N/A Util.followLinks(options));
3471N/A }
3471N/A if (name.equals("user")) {
3471N/A return new LinuxUserDefinedFileAttributeView(UnixPath.toUnixPath(obj),
3899N/A Util.followLinks(options));
3471N/A }
3471N/A return super.getFileAttributeView(obj, name, options);
3471N/A }
3471N/A
3471N/A @Override
3471N/A @SuppressWarnings("unchecked")
3471N/A public <A extends BasicFileAttributes> A readAttributes(Path file,
3471N/A Class<A> type,
3471N/A LinkOption... options)
3471N/A throws IOException
3471N/A {
3471N/A if (type == DosFileAttributes.class) {
3471N/A DosFileAttributeView view =
3471N/A getFileAttributeView(file, DosFileAttributeView.class, options);
3471N/A return (A) view.readAttributes();
3471N/A } else {
3471N/A return super.readAttributes(file, type, options);
3471N/A }
3471N/A }
5316N/A
5316N/A @Override
5316N/A FileTypeDetector getFileTypeDetector() {
5316N/A return new GnomeFileTypeDetector();
5316N/A }
893N/A}