Thu, 15 Nov 2012 23:07:24 -0800
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
Reviewed-by: darcy
duke@1 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@554 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@554 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
ohair@554 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | package javax.tools; |
duke@1 | 27 | |
duke@1 | 28 | import java.io.IOException; |
duke@1 | 29 | import java.io.InputStream; |
duke@1 | 30 | import java.io.OutputStream; |
duke@1 | 31 | import java.io.Reader; |
duke@1 | 32 | import java.io.Writer; |
duke@1 | 33 | import java.net.URI; |
duke@1 | 34 | |
duke@1 | 35 | /** |
duke@1 | 36 | * Forwards calls to a given file object. Subclasses of this class |
duke@1 | 37 | * might override some of these methods and might also provide |
duke@1 | 38 | * additional fields and methods. |
duke@1 | 39 | * |
duke@1 | 40 | * @param <F> the kind of file object forwarded to by this object |
duke@1 | 41 | * @author Peter von der Ahé |
duke@1 | 42 | * @since 1.6 |
duke@1 | 43 | */ |
duke@1 | 44 | public class ForwardingFileObject<F extends FileObject> implements FileObject { |
duke@1 | 45 | |
duke@1 | 46 | /** |
duke@1 | 47 | * The file object which all methods are delegated to. |
duke@1 | 48 | */ |
duke@1 | 49 | protected final F fileObject; |
duke@1 | 50 | |
duke@1 | 51 | /** |
duke@1 | 52 | * Creates a new instance of ForwardingFileObject. |
duke@1 | 53 | * @param fileObject delegate to this file object |
duke@1 | 54 | */ |
duke@1 | 55 | protected ForwardingFileObject(F fileObject) { |
duke@1 | 56 | fileObject.getClass(); // null check |
duke@1 | 57 | this.fileObject = fileObject; |
duke@1 | 58 | } |
duke@1 | 59 | |
duke@1 | 60 | public URI toUri() { |
duke@1 | 61 | return fileObject.toUri(); |
duke@1 | 62 | } |
duke@1 | 63 | |
duke@1 | 64 | public String getName() { |
duke@1 | 65 | return fileObject.getName(); |
duke@1 | 66 | } |
duke@1 | 67 | |
duke@1 | 68 | /** |
duke@1 | 69 | * @throws IllegalStateException {@inheritDoc} |
duke@1 | 70 | * @throws UnsupportedOperationException {@inheritDoc} |
duke@1 | 71 | * @throws IOException {@inheritDoc} |
duke@1 | 72 | */ |
duke@1 | 73 | public InputStream openInputStream() throws IOException { |
duke@1 | 74 | return fileObject.openInputStream(); |
duke@1 | 75 | } |
duke@1 | 76 | |
duke@1 | 77 | /** |
duke@1 | 78 | * @throws IllegalStateException {@inheritDoc} |
duke@1 | 79 | * @throws UnsupportedOperationException {@inheritDoc} |
duke@1 | 80 | * @throws IOException {@inheritDoc} |
duke@1 | 81 | */ |
duke@1 | 82 | public OutputStream openOutputStream() throws IOException { |
duke@1 | 83 | return fileObject.openOutputStream(); |
duke@1 | 84 | } |
duke@1 | 85 | |
duke@1 | 86 | /** |
duke@1 | 87 | * @throws IllegalStateException {@inheritDoc} |
duke@1 | 88 | * @throws UnsupportedOperationException {@inheritDoc} |
duke@1 | 89 | * @throws IOException {@inheritDoc} |
duke@1 | 90 | */ |
duke@1 | 91 | public Reader openReader(boolean ignoreEncodingErrors) throws IOException { |
duke@1 | 92 | return fileObject.openReader(ignoreEncodingErrors); |
duke@1 | 93 | } |
duke@1 | 94 | |
duke@1 | 95 | /** |
duke@1 | 96 | * @throws IllegalStateException {@inheritDoc} |
duke@1 | 97 | * @throws UnsupportedOperationException {@inheritDoc} |
duke@1 | 98 | * @throws IOException {@inheritDoc} |
duke@1 | 99 | */ |
duke@1 | 100 | public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { |
duke@1 | 101 | return fileObject.getCharContent(ignoreEncodingErrors); |
duke@1 | 102 | } |
duke@1 | 103 | |
duke@1 | 104 | /** |
duke@1 | 105 | * @throws IllegalStateException {@inheritDoc} |
duke@1 | 106 | * @throws UnsupportedOperationException {@inheritDoc} |
duke@1 | 107 | * @throws IOException {@inheritDoc} |
duke@1 | 108 | */ |
duke@1 | 109 | public Writer openWriter() throws IOException { |
duke@1 | 110 | return fileObject.openWriter(); |
duke@1 | 111 | } |
duke@1 | 112 | |
duke@1 | 113 | public long getLastModified() { |
duke@1 | 114 | return fileObject.getLastModified(); |
duke@1 | 115 | } |
duke@1 | 116 | |
duke@1 | 117 | public boolean delete() { |
duke@1 | 118 | return fileObject.delete(); |
duke@1 | 119 | } |
duke@1 | 120 | } |