JDK 11 jdk.javadoc.jmod - Java Document Tool

JDK 11 jdk.javadoc.jmod is the JMOD file for JDK 11 Java Document tool, which can be invoked by the "javadoc" command.

JDK 11 Java Document tool compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.javadoc.jmod.

JDK 11 Java Document tool compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.

JDK 11 Java Document tool source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.javadoc.

You can click and view the content of each source code file in the list below.

✍: FYIcenter

com/sun/tools/javadoc/main/DocLocale.java

/*
 * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package com.sun.tools.javadoc.main;

import java.text.BreakIterator;
import java.text.Collator;
import java.util.Locale;

/**
 * This class holds the information about locales.
 *
 *  <p><b>This is NOT part of any supported API.
 *  If you write code that depends on this, you do so at your own risk.
 *  This code and its internal interfaces are subject to change or
 *  deletion without notice.</b>
 *
 * @since 1.4
 * @author Robert Field
 */
@Deprecated(since="9", forRemoval=true)
@SuppressWarnings("removal")
class DocLocale {

    /**
     * The locale name will be set by Main, if option is provided on the
     * command line.
     */
    final String localeName;

    /**
     * The locale to be used. If user doesn't provide this,
     * then set it to default locale value.
     */
    final Locale locale;

    /**
     * The collator for this application. This is to take care of Locale
     * Specific or Natural Language Text sorting.
     */
    final Collator collator;

    /**
     * Enclosing DocEnv
     */
    private final DocEnv docenv;

    /**
     * Sentence instance from the BreakIterator.
     */
    private final BreakIterator sentenceBreaker;

    /**
     * True is we should use <code>BreakIterator</code>
     * to compute first sentence.
     */
    private boolean useBreakIterator = false;

    /**
     * The HTML sentence terminators.
     */
    static final String[] sentenceTerminators =
                    {
                        "<p>", "</p>", "<h1>", "<h2>",
                        "<h3>", "<h4>", "<h5>", "<h6>",
                        "</h1>", "</h2>", "</h3>", "</h4>", "</h5>",
                        "</h6>", "<hr>", "<pre>", "</pre>"
                    };

    /**
     * Constructor
     */
    DocLocale(DocEnv docenv, String localeName, boolean useBreakIterator) {
        this.docenv = docenv;
        this.localeName = localeName;
        this.useBreakIterator = useBreakIterator;
        locale = getLocale();
        if (locale == null) {
            docenv.exit();
        } else {
            Locale.setDefault(locale); // NOTE: updating global state
        }
        collator = Collator.getInstance(locale);
        sentenceBreaker = BreakIterator.getSentenceInstance(locale);
    }

    /**
     * Get the locale if specified on the command line
     * else return null and if locale option is not used
     * then return default locale.
     */
    private Locale getLocale() {
        Locale userlocale = null;
        if (localeName.length() > 0) {
            int firstuscore = localeName.indexOf('_');
            int seconduscore = -1;
            String language = null;
            String country = null;
            String variant = null;
            if (firstuscore == 2) {
                language = localeName.substring(0, firstuscore);
                seconduscore = localeName.indexOf('_', firstuscore + 1);
                if (seconduscore > 0) {
                    if (seconduscore != firstuscore + 3 ||
                           localeName.length() <= seconduscore + 1) {
                        docenv.error(null, "main.malformed_locale_name", localeName);
                        return null;
                    }
                    country = localeName.substring(firstuscore + 1,
                                                   seconduscore);
                    variant = localeName.substring(seconduscore + 1);
                } else if (localeName.length() == firstuscore + 3) {
                    country = localeName.substring(firstuscore + 1);
                } else {
                    docenv.error(null, "main.malformed_locale_name", localeName);
                    return null;
                }
            } else if (firstuscore == -1 && localeName.length() == 2) {
                language = localeName;
            } else {
                docenv.error(null, "main.malformed_locale_name", localeName);
                return null;
            }
            userlocale = searchLocale(language, country, variant);
            if (userlocale == null) {
                docenv.error(null, "main.illegal_locale_name", localeName);
                return null;
            } else {
                return userlocale;
            }
        } else {
            return Locale.getDefault();
        }
    }

    /**
     * Search the locale for specified language, specified country and
     * specified variant.
     */
    private Locale searchLocale(String language, String country,
                                String variant) {
        for (Locale loc : Locale.getAvailableLocales()) {
            if (loc.getLanguage().equals(language) &&
                (country == null || loc.getCountry().equals(country)) &&
                (variant == null || loc.getVariant().equals(variant))) {
                return loc;
            }
        }
        return null;
    }

    String localeSpecificFirstSentence(DocImpl doc, String s) {
        if (s == null || s.length() == 0) {
            return "";
        }
        int index = s.indexOf("-->");
        if(s.trim().startsWith("<!--") && index != -1) {
            return localeSpecificFirstSentence(doc, s.substring(index + 3, s.length()));
        }
        if (useBreakIterator || !locale.getLanguage().equals("en")) {
            sentenceBreaker.setText(s.replace('\n', ' '));
            int start = sentenceBreaker.first();
            int end = sentenceBreaker.next();
            return s.substring(start, end).trim();
        } else {
            return englishLanguageFirstSentence(s).trim();
        }
    }

    /**
     * Return the first sentence of a string, where a sentence ends
     * with a period followed be white space.
     */
    private String englishLanguageFirstSentence(String s) {
        if (s == null) {
            return null;
        }
        int len = s.length();
        boolean period = false;
        for (int i = 0 ; i < len ; i++) {
            switch (s.charAt(i)) {
                case '.':
                    period = true;
                    break;
                case ' ':
                case '\t':
                case '\n':
            case '\r':
            case '\f':
                    if (period) {
                        return s.substring(0, i);
                    }
                    break;
            case '<':
                    if (i > 0) {
                        if (htmlSentenceTerminatorFound(s, i)) {
                            return s.substring(0, i);
                        }
                    }
                    break;
                default:
                    period = false;
            }
        }
        return s;
    }

    /**
     * Find out if there is any HTML tag in the given string. If found
     * return true else return false.
     */
    private boolean htmlSentenceTerminatorFound(String str, int index) {
        for (String terminator : sentenceTerminators) {
            if (str.regionMatches(true, index, terminator,
                                  0, terminator.length())) {
                return true;
            }
        }
        return false;
    }
}

com/sun/tools/javadoc/main/DocLocale.java

 

Or download all of them as a single archive file:

File name: jdk.javadoc-11.0.1-src.zip
File size: 680806 bytes
Release date: 2018-11-04
Download 

 

JDK 11 jdk.jcmd.jmod - JCmd Tool

JDK 11 jdk.jartool.jmod - JAR Tool

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2020-07-22, 77183👍, 0💬