/* * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Sun designates this * particular file as subject to the "Classpath" exception as provided * by Sun in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ package javax.tools; import java.io.File; import java.io.IOException; import java.util.*; /** * File manager based on {@linkplain File java.io.File}. A common way * to obtain an instance of this class is using {@linkplain * JavaCompiler#getStandardFileManager * getStandardFileManager}, for example: * *
 *   JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
 *   {@code DiagnosticCollector} diagnostics =
 *       new {@code DiagnosticCollector()};
 *   StandardJavaFileManager fm = compiler.getStandardFileManager(diagnostics, null, null);
 * 
* * This file manager creates file objects representing regular * {@linkplain File files}, * {@linkplain java.util.zip.ZipEntry zip file entries}, or entries in * similar file system based containers. Any file object returned * from a file manager implementing this interface must observe the * following behavior: * * * * According to these rules, the following URIs, for example, are * allowed: * * Whereas these are not (reason in parentheses): * * * @author Peter von der Ahé * @since 1.6 */ public interface StandardJavaFileManager extends JavaFileManager { /** * Compares two file objects and return true if they represent the * same canonical file, zip file entry, or entry in any file * system based container. * * @param a a file object * @param b a file object * @return true if the given file objects represent the same * canonical file or zip file entry; false otherwise * * @throws IllegalArgumentException if either of the arguments * were created with another file manager implementation */ boolean isSameFile(FileObject a, FileObject b); /** * Gets file objects representing the given files. * * @param files a list of files * @return a list of file objects * @throws IllegalArgumentException if the list of files includes * a directory */ Iterable getJavaFileObjectsFromFiles( Iterable files); /** * Gets file objects representing the given files. * Convenience method equivalent to: * *
     *     getJavaFileObjectsFromFiles({@linkplain java.util.Arrays#asList Arrays.asList}(files))
     * 
* * @param files an array of files * @return a list of file objects * @throws IllegalArgumentException if the array of files includes * a directory * @throws NullPointerException if the given array contains null * elements */ Iterable getJavaFileObjects(File... files); /** * Gets file objects representing the given file names. * * @param names a list of file names * @return a list of file objects * @throws IllegalArgumentException if the list of file names * includes a directory */ Iterable getJavaFileObjectsFromStrings( Iterable names); /** * Gets file objects representing the given file names. * Convenience method equivalent to: * *
     *     getJavaFileObjectsFromStrings({@linkplain java.util.Arrays#asList Arrays.asList}(names))
     * 
* * @param names a list of file names * @return a list of file objects * @throws IllegalArgumentException if the array of file names * includes a directory * @throws NullPointerException if the given array contains null * elements */ Iterable getJavaFileObjects(String... names); /** * Associates the given path with the given location. Any * previous value will be discarded. * * @param location a location * @param path a list of files, if {@code null} use the default * path for this location * @see #getLocation * @throws IllegalArgumentException if location is an output * location and path does not contain exactly one element * @throws IOException if location is an output location and path * does not represent an existing directory */ void setLocation(Location location, Iterable path) throws IOException; /** * Gets the path associated with the given location. * * @param location a location * @return a list of files or {@code null} if this location has no * associated path * @see #setLocation */ Iterable getLocation(Location location); }