langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java
author jjg
Mon, 15 Feb 2016 14:02:57 -0800
changeset 36037 688096b6bcc4
parent 25874 83c19f00452c
child 36526 3b41f1c69604
permissions -rw-r--r--
8149773: StandardDocFileFactory should be converted to use java.nio.file.Path Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     1
/*
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
     2
 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     4
 *
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    10
 *
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    15
 * accompanied this code).
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    16
 *
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    20
 *
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    23
 * questions.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    24
 */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    25
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    26
package com.sun.tools.doclets.internal.toolkit.util;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    27
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    28
import java.io.BufferedInputStream;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    29
import java.io.BufferedOutputStream;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    30
import java.io.BufferedWriter;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    31
import java.io.IOException;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    32
import java.io.InputStream;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    33
import java.io.OutputStream;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    34
import java.io.OutputStreamWriter;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    35
import java.io.UnsupportedEncodingException;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    36
import java.io.Writer;
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    37
import java.nio.file.DirectoryStream;
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    38
import java.nio.file.Files;
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    39
import java.nio.file.Path;
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    40
import java.nio.file.Paths;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    41
import java.util.ArrayList;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    42
import java.util.Arrays;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    43
import java.util.LinkedHashSet;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    44
import java.util.List;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    45
import java.util.Set;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    46
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    47
import javax.tools.DocumentationTool;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    48
import javax.tools.FileObject;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    49
import javax.tools.JavaFileManager.Location;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    50
import javax.tools.JavaFileObject;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    51
import javax.tools.StandardJavaFileManager;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    52
import javax.tools.StandardLocation;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    53
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    54
import com.sun.tools.doclets.internal.toolkit.Configuration;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    55
import com.sun.tools.javac.util.Assert;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    56
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    57
/**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    58
 * Implementation of DocFileFactory using a {@link StandardJavaFileManager}.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    59
 *
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    60
 *  <p><b>This is NOT part of any supported API.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    61
 *  If you write code that depends on this, you do so at your own risk.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    62
 *  This code and its internal interfaces are subject to change or
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    63
 *  deletion without notice.</b>
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    64
 *
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    65
 * @since 1.8
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    66
 */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    67
class StandardDocFileFactory extends DocFileFactory {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    68
    private final StandardJavaFileManager fileManager;
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    69
    private Path destDir;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    70
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    71
    public StandardDocFileFactory(Configuration configuration) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    72
        super(configuration);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    73
        fileManager = (StandardJavaFileManager) configuration.getFileManager();
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    74
    }
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    75
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    76
    private Path getDestDir() {
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    77
        if (destDir == null) {
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    78
            if (!configuration.destDirName.isEmpty()
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    79
                    || !fileManager.hasLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT)) {
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    80
                try {
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    81
                    String dirName = configuration.destDirName.isEmpty() ? "." : configuration.destDirName;
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    82
                    Path dir = Paths.get(dirName);
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    83
                    fileManager.setLocationFromPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir));
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    84
                } catch (IOException e) {
19667
fdfce85627a9 8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents: 14545
diff changeset
    85
                    throw new DocletAbortException(e);
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    86
                }
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    87
            }
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    88
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    89
            destDir = fileManager.getLocationAsPaths(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next();
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    90
        }
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
    91
        return destDir;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    92
    }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    93
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    94
    public DocFile createFileForDirectory(String file) {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    95
        return new StandardDocFile(Paths.get(file));
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    96
    }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    97
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
    98
    public DocFile createFileForInput(String file) {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
    99
        return new StandardDocFile(Paths.get(file));
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   100
    }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   101
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   102
    public DocFile createFileForOutput(DocPath path) {
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   103
        return new StandardDocFile(DocumentationTool.Location.DOCUMENTATION_OUTPUT, path);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   104
    }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   105
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   106
    @Override
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   107
    Iterable<DocFile> list(Location location, DocPath path) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   108
        if (location != StandardLocation.SOURCE_PATH)
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   109
            throw new IllegalArgumentException();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   110
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 19667
diff changeset
   111
        Set<DocFile> files = new LinkedHashSet<>();
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   112
        Location l = fileManager.hasLocation(StandardLocation.SOURCE_PATH)
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   113
                ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   114
        for (Path f: fileManager.getLocationAsPaths(l)) {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   115
            if (Files.isDirectory(f)) {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   116
                f = f.resolve(path.getPath());
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   117
                if (Files.exists(f))
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   118
                    files.add(new StandardDocFile(f));
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   119
            }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   120
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   121
        return files;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   122
    }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   123
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   124
    private static Path newFile(Path dir, String path) {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   125
        return (dir == null) ? Paths.get(path) : dir.resolve(path);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   126
    }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   127
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   128
    class StandardDocFile extends DocFile {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   129
        private Path file;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   130
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   131
        /** Create a StandardDocFile for a given file. */
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   132
        private StandardDocFile(Path file) {
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   133
            super(configuration);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   134
            this.file = file;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   135
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   136
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   137
        /** Create a StandardDocFile for a given location and relative path. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   138
        private StandardDocFile(Location location, DocPath path) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   139
            super(configuration, location, path);
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   140
            Assert.check(location == DocumentationTool.Location.DOCUMENTATION_OUTPUT);
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   141
            this.file = newFile(getDestDir(), path.getPath());
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   142
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   143
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   144
        /** Open an input stream for the file. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   145
        public InputStream openInputStream() throws IOException {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   146
            JavaFileObject fo = getJavaFileObjectForInput(file);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   147
            return new BufferedInputStream(fo.openInputStream());
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   148
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   149
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   150
        /**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   151
         * Open an output stream for the file.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   152
         * The file must have been created with a location of
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   153
         * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   154
         */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   155
        public OutputStream openOutputStream() throws IOException, UnsupportedEncodingException {
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   156
            if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   157
                throw new IllegalStateException();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   158
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   159
            OutputStream out = getFileObjectForOutput(path).openOutputStream();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   160
            return new BufferedOutputStream(out);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   161
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   162
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   163
        /**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   164
         * Open an writer for the file, using the encoding (if any) given in the
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   165
         * doclet configuration.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   166
         * The file must have been created with a location of
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   167
         * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path.
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   168
         */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   169
        public Writer openWriter() throws IOException, UnsupportedEncodingException {
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   170
            if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   171
                throw new IllegalStateException();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   172
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   173
            OutputStream out = getFileObjectForOutput(path).openOutputStream();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   174
            if (configuration.docencoding == null) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   175
                return new BufferedWriter(new OutputStreamWriter(out));
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   176
            } else {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   177
                return new BufferedWriter(new OutputStreamWriter(out, configuration.docencoding));
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   178
            }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   179
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   180
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   181
        /** Return true if the file can be read. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   182
        public boolean canRead() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   183
            return Files.isReadable(file);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   184
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   185
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   186
        /** Return true if the file can be written. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   187
        public boolean canWrite() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   188
            return Files.isWritable(file);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   189
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   190
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   191
        /** Return true if the file exists. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   192
        public boolean exists() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   193
            return Files.exists(file);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   194
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   195
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   196
        /** Return the base name (last component) of the file name. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   197
        public String getName() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   198
            return file.getFileName().toString();
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   199
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   200
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   201
        /** Return the file system path for this file. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   202
        public String getPath() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   203
            return file.toString();
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   204
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   205
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   206
        /** Return true is file has an absolute path name. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   207
        public boolean isAbsolute() {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   208
            return file.isAbsolute();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   209
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   210
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   211
        /** Return true is file identifies a directory. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   212
        public boolean isDirectory() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   213
            return Files.isDirectory(file);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   214
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   215
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   216
        /** Return true is file identifies a file. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   217
        public boolean isFile() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   218
            return Files.isRegularFile(file);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   219
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   220
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   221
        /** Return true if this file is the same as another. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   222
        public boolean isSameFile(DocFile other) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   223
            if (!(other instanceof StandardDocFile))
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   224
                return false;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   225
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   226
            try {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   227
                return Files.isSameFile(file, ((StandardDocFile) other).file);
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   228
            } catch (IOException e) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   229
                return false;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   230
            }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   231
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   232
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   233
        /** If the file is a directory, list its contents. */
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   234
        public Iterable<DocFile> list() throws IOException {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   235
            List<DocFile> files = new ArrayList<DocFile>();
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   236
            try (DirectoryStream<Path> ds = Files.newDirectoryStream(file)) {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   237
                for (Path f: ds) {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   238
                    files.add(new StandardDocFile(f));
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   239
                }
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   240
            }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   241
            return files;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   242
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   243
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   244
        /** Create the file as a directory, including any parent directories. */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   245
        public boolean mkdirs() {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   246
            try {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   247
                Files.createDirectories(file);
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   248
                return true;
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   249
            } catch (IOException e) {
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   250
                return false;
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   251
            }
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   252
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   253
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   254
        /**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   255
         * Derive a new file by resolving a relative path against this file.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   256
         * The new file will inherit the configuration and location of this file
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   257
         * If this file has a path set, the new file will have a corresponding
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   258
         * new path.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   259
         */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   260
        public DocFile resolve(DocPath p) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   261
            return resolve(p.getPath());
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   262
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   263
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   264
        /**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   265
         * Derive a new file by resolving a relative path against this file.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   266
         * The new file will inherit the configuration and location of this file
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   267
         * If this file has a path set, the new file will have a corresponding
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   268
         * new path.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   269
         */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   270
        public DocFile resolve(String p) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   271
            if (location == null && path == null) {
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   272
                return new StandardDocFile(file.resolve(p));
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   273
            } else {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   274
                return new StandardDocFile(location, path.resolve(p));
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   275
            }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   276
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   277
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   278
        /**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   279
         * Resolve a relative file against the given output location.
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   280
         * @param locn Currently, only
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   281
         * {@link DocumentationTool.Location.DOCUMENTATION_OUTPUT} is supported.
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   282
         */
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   283
        public DocFile resolveAgainst(Location locn) {
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   284
            if (locn != DocumentationTool.Location.DOCUMENTATION_OUTPUT)
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   285
                throw new IllegalArgumentException();
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   286
            return new StandardDocFile(getDestDir().resolve(file));
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   287
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   288
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   289
        /** Return a string to identify the contents of this object,
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   290
         * for debugging purposes.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   291
         */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   292
        @Override
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   293
        public String toString() {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   294
            StringBuilder sb = new StringBuilder();
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   295
            sb.append("PathDocFile[");
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   296
            if (location != null)
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   297
                sb.append("locn:").append(location).append(",");
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   298
            if (path != null)
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   299
                sb.append("path:").append(path.getPath()).append(",");
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   300
            sb.append("file:").append(file);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   301
            sb.append("]");
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   302
            return sb.toString();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   303
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   304
36037
688096b6bcc4 8149773: StandardDocFileFactory should be converted to use java.nio.file.Path
jjg
parents: 25874
diff changeset
   305
        private JavaFileObject getJavaFileObjectForInput(Path file) {
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   306
            return fileManager.getJavaFileObjects(file).iterator().next();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   307
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   308
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   309
        private FileObject getFileObjectForOutput(DocPath path) throws IOException {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   310
            // break the path into a package-part and the rest, by finding
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   311
            // the position of the last '/' before an invalid character for a
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   312
            // package name, such as the "." before an extension or the "-"
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   313
            // in filenames like package-summary.html, doc-files or src-html.
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   314
            String p = path.getPath();
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   315
            int lastSep = -1;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   316
            for (int i = 0; i < p.length(); i++) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   317
                char ch = p.charAt(i);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   318
                if (ch == '/') {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   319
                    lastSep = i;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   320
                } else if (i == lastSep + 1 && !Character.isJavaIdentifierStart(ch)
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   321
                        || !Character.isJavaIdentifierPart(ch)) {
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   322
                    break;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   323
                }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   324
            }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   325
            String pkg = (lastSep == -1) ? "" : p.substring(0, lastSep);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   326
            String rest = p.substring(lastSep + 1);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   327
            return fileManager.getFileForOutput(location, pkg, rest, null);
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   328
        }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   329
    }
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents:
diff changeset
   330
}