jjg@450: /* jjg@1358: * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. jjg@450: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@450: * jjg@450: * This code is free software; you can redistribute it and/or modify it jjg@450: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this jjg@450: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. jjg@450: * jjg@450: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@450: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@450: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@450: * version 2 for more details (a copy is included in the LICENSE file that jjg@450: * accompanied this code). jjg@450: * jjg@450: * You should have received a copy of the GNU General Public License version jjg@450: * 2 along with this work; if not, write to the Free Software Foundation, jjg@450: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@450: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. jjg@450: */ jjg@450: jjg@450: package com.sun.tools.javac.nio; jjg@450: jjg@450: import java.io.IOException; jjg@450: import java.nio.file.FileSystem; jjg@1358: import java.nio.file.FileSystems; jjg@450: import java.nio.file.Path; jjg@450: import javax.tools.FileObject; jjg@450: import javax.tools.JavaFileManager; jjg@450: import javax.tools.JavaFileObject; jjg@450: jjg@450: /** jjg@1358: * File manager based on {@link java.nio.file.Path}. jjg@450: * jjg@450: * Eventually, this should be moved to javax.tools. jjg@450: * Also, JavaCompiler might reasonably provide a method getPathFileManager, jjg@450: * similar to {@link javax.tools.JavaCompiler#getStandardFileManager jjg@450: * getStandardFileManager}. However, would need to be handled carefully jjg@450: * as another forward reference from langtools to jdk. jjg@450: * jjg@581: *

This is NOT part of any supported API. jjg@581: * If you write code that depends on this, you do so at your own risk. jjg@450: * This code and its internal interfaces are subject to change or jjg@450: * deletion without notice. jjg@450: */ jjg@450: public interface PathFileManager extends JavaFileManager { jjg@450: /** jjg@450: * Get the default file system used to create paths. If no value has been jjg@450: * set, the default file system is {@link FileSystems#getDefault}. jjg@450: */ jjg@450: FileSystem getDefaultFileSystem(); jjg@450: jjg@450: /** jjg@450: * Set the default file system used to create paths. jjg@450: * @param fs the default file system used to create any new paths. jjg@450: */ jjg@450: void setDefaultFileSystem(FileSystem fs); jjg@450: jjg@450: /** jjg@450: * Get file objects representing the given files. jjg@450: * jjg@450: * @param paths a list of paths jjg@450: * @return a list of file objects jjg@450: * @throws IllegalArgumentException if the list of paths includes jjg@450: * a directory jjg@450: */ jjg@450: Iterable getJavaFileObjectsFromPaths( jjg@450: Iterable paths); jjg@450: jjg@450: /** jjg@450: * Get file objects representing the given paths. jjg@450: * Convenience method equivalent to: jjg@450: * jjg@450: *

jjg@450:      *     getJavaFileObjectsFromPaths({@linkplain java.util.Arrays#asList Arrays.asList}(paths))
jjg@450:      * 
jjg@450: * jjg@450: * @param paths an array of paths jjg@450: * @return a list of file objects jjg@450: * @throws IllegalArgumentException if the array of files includes jjg@450: * a directory jjg@450: * @throws NullPointerException if the given array contains null jjg@450: * elements jjg@450: */ jjg@450: Iterable getJavaFileObjects(Path... paths); jjg@450: jjg@450: /** jjg@450: * Return the Path for a file object that has been obtained from this jjg@450: * file manager. jjg@450: * jjg@450: * @param fo A file object that has been obtained from this file manager. jjg@450: * @return The underlying Path object. jjg@450: * @throws IllegalArgumentException is the file object was not obtained from jjg@450: * from this file manager. jjg@450: */ jjg@450: Path getPath(FileObject fo); jjg@450: jjg@450: /** jjg@450: * Get the search path associated with the given location. jjg@450: * jjg@450: * @param location a location jjg@450: * @return a list of paths or {@code null} if this location has no jjg@450: * associated search path jjg@450: * @see #setLocation jjg@450: */ jjg@450: Iterable getLocation(Location location); jjg@450: jjg@450: /** jjg@450: * Associate the given search path with the given location. Any jjg@450: * previous value will be discarded. jjg@450: * jjg@450: * @param location a location jjg@450: * @param searchPath a list of files, if {@code null} use the default jjg@450: * search path for this location jjg@450: * @see #getLocation jjg@450: * @throws IllegalArgumentException if location is an output jjg@450: * location and searchpath does not contain exactly one element jjg@450: * @throws IOException if location is an output location and searchpath jjg@450: * does not represent an existing directory jjg@450: */ jjg@450: void setLocation(Location location, Iterable searchPath) throws IOException; jjg@450: }