This commit is contained in:
Lana Steuck 2015-08-06 11:19:53 -07:00
commit 8145a4b457
395 changed files with 15979 additions and 4370 deletions

View File

@ -0,0 +1,52 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
##########################################################################################
### CLDRConverter needs the JRE time zone names from the java.base source.
define cldrconverter_copytznames
$(MKDIR) -p '$(@D)'
$(RM) '$@'
$(SED) -e "s/package sun.util.resources/package build.tools.cldrconverter/" \
-e "s/extends TimeZoneNamesBundle//" \
-e "s/protected final/static final/" \
< $(<) > $@
endef
$(eval $(call SetupCopyFiles,COPY_INTERIM_CLDRCONVERTER, \
SRC := $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources, \
DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes/build/tools/cldrconverter, \
FILES := TimeZoneNames.java, \
MACRO := cldrconverter_copytznames))
##########################################################################################
all: $(COPY_INTERIM_CLDRCONVERTER)

View File

@ -38,8 +38,8 @@ include SetupJavaCompilers.gmk
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
SETUP := GENERATE_OLDBYTECODE, \
ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes", \
SRC := $(JDK_TOPDIR)/make/src/classes, \
ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes", \
SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
COPY := boot.modules ext.modules))

View File

@ -27,6 +27,10 @@ include LauncherCommon.gmk
$(eval $(call SetupLauncher,jsadebugd, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
-DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
,,,,,,,,,Info-privileged.plist))
$(eval $(call SetupLauncher,jhsdb, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.SALauncher"$(COMMA) }' \
,,,,,,,,,Info-privileged.plist))

View File

@ -27,12 +27,15 @@ package build.tools.cldrconverter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.ResourceBundle;
class Bundle {
static enum Type {
@ -145,6 +148,13 @@ class Bundle {
return id;
}
String getJavaID() {
// Tweak ISO compatibility for bundle generation
return id.replaceFirst("^he", "iw")
.replaceFirst("^id", "in")
.replaceFirst("^yi", "ji");
}
boolean isRoot() {
return "root".equals(id);
}
@ -298,8 +308,8 @@ class Bundle {
continue;
}
if (id.startsWith("en")) {
fillInAbbrs(key, nameMap);
if (id.equals("en")) {
fillInJREs(key, nameMap);
}
}
}
@ -381,7 +391,8 @@ class Bundle {
if (Objects.nonNull(parentsMap)) {
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
if (Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
if (!key.equals("numberingScripts") && // real body "NumberElements" may differ
Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
it.remove();
}
}
@ -621,78 +632,41 @@ class Bundle {
return null;
}
private void fillInAbbrs(String key, Map<String, String> map) {
fillInAbbrs(TZ_STD_LONG_KEY, TZ_STD_SHORT_KEY, map);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
static Object[][] jreTimeZoneNames = TimeZoneNames.getContents();
private void fillInJREs(String key, Map<String, String> map) {
String tzid = null;
// If the standard std is "Standard Time" and daylight std is "Summer Time",
// replace the standard std with the generic std to avoid using
// the same abbrivation except for Australia time zone names.
String std = map.get(TZ_STD_SHORT_KEY);
String dst = map.get(TZ_DST_SHORT_KEY);
String gen = map.get(TZ_GEN_SHORT_KEY);
if (std != null) {
if (dst == null) {
// if dst is null, create long and short names from the standard
// std. ("Something Standard Time" to "Something Daylight Time",
// or "Something Time" to "Something Summer Time")
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.contains("Standard Time")) {
name = name.replace("Standard Time", "Daylight Time");
} else if (name.endsWith("Mean Time")) {
if (!name.startsWith("Greenwich ")) {
name = name.replace("Mean Time", "Summer Time");
if (key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
// Look for tzid
String meta = key.substring(CLDRConverter.METAZONE_ID_PREFIX.length());
if (meta.equals("GMT")) {
tzid = meta;
} else {
for (String tz : CLDRConverter.handlerMetaZones.keySet()) {
if (CLDRConverter.handlerMetaZones.get(tz).equals(meta)) {
tzid = tz;
break;
}
} else if (name.endsWith(" Time")) {
name = name.replace(" Time", " Summer Time");
}
map.put(TZ_DST_LONG_KEY, name);
fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
}
}
if (gen == null) {
String name = map.get(TZ_STD_LONG_KEY);
if (name != null) {
if (name.endsWith("Standard Time")) {
name = name.replace("Standard Time", "Time");
} else if (name.endsWith("Mean Time")) {
if (!name.startsWith("Greenwich ")) {
name = name.replace("Mean Time", "Time");
}
}
map.put(TZ_GEN_LONG_KEY, name);
fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
}
}
}
} else {
tzid = key.substring(CLDRConverter.TIMEZONE_ID_PREFIX.length());
}
private void fillInAbbrs(String longKey, String shortKey, Map<String, String> map) {
String abbr = map.get(shortKey);
if (abbr == null) {
String name = map.get(longKey);
if (name != null) {
abbr = toAbbr(name);
if (abbr != null) {
map.put(shortKey, abbr);
if (tzid != null) {
for (Object[] jreZone : jreTimeZoneNames) {
if (jreZone[0].equals(tzid)) {
for (int i = 0; i < ZONE_NAME_KEYS.length; i++) {
if (map.get(ZONE_NAME_KEYS[i]) == null) {
String[] jreNames = (String[])jreZone[1];
map.put(ZONE_NAME_KEYS[i], jreNames[i]);
}
}
break;
}
}
private String toAbbr(String name) {
String[] substrs = name.split("\\s+");
StringBuilder sb = new StringBuilder();
for (String s : substrs) {
char c = s.charAt(0);
if (c >= 'A' && c <= 'Z') {
sb.append(c);
}
}
return sb.length() > 0 ? sb.toString() : null;
}
private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {

View File

@ -433,35 +433,35 @@ public class CLDRConverter {
Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, bundle.getID());
if (!localeNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, BundleType.OPEN);
bundleGenerator.generateBundle("util", "LocaleNames", bundle.getJavaID(), true, localeNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) {
Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies());
if (!currencyNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, BundleType.OPEN);
bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getJavaID(), true, currencyNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) {
Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, bundle.getID());
if (!zoneNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("TimeZoneNames").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getID(), true, zoneNamesMap, BundleType.TIMEZONE);
bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getJavaID(), true, zoneNamesMap, BundleType.TIMEZONE);
}
}
if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) {
Map<String, Object> calendarDataMap = extractCalendarData(targetMap, bundle.getID());
if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN);
bundleGenerator.generateBundle("util", "CalendarData", bundle.getJavaID(), true, calendarDataMap, BundleType.PLAIN);
}
}
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
Map<String, Object> formatDataMap = extractFormatData(targetMap, bundle.getID());
if (!formatDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
bundleGenerator.generateBundle("text", "FormatData", bundle.getJavaID(), true, formatDataMap, BundleType.PLAIN);
}
}

View File

@ -27,6 +27,7 @@ package build.tools.cldrconverter;
import java.io.File;
import java.io.IOException;
import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -900,6 +901,12 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
Entry<?> entry = (Entry<?>) currentContainer;
Object value = entry.getValue();
if (value != null) {
String key = entry.getKey();
// Tweak for MonthNames for the root locale, Needed for
// SimpleDateFormat.format()/parse() roundtrip.
if (id.equals("root") && key.startsWith("MonthNames")) {
value = new DateFormatSymbols(Locale.US).getShortMonths();
}
put(entry.getKey(), value);
}
}

View File

@ -82,7 +82,7 @@ public final class BlowfishCipher extends CipherSpi {
/**
* Sets the padding mechanism of this cipher.
*
* @param padding the padding mechanism
* @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* does not exist

View File

@ -77,7 +77,7 @@ public final class DESCipher extends CipherSpi {
/**
* Sets the padding mechanism of this cipher.
*
* @param padding the padding mechanism
* @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* does not exist

View File

@ -74,7 +74,7 @@ public final class DESedeCipher extends CipherSpi {
/**
* Sets the padding mechanism of this cipher.
*
* @param padding the padding mechanism
* @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* does not exist

View File

@ -32,7 +32,7 @@ import javax.crypto.spec.*;
/**
* This class implements the CMS DESede KeyWrap algorithm as defined
* in <a href=http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap>
* in <a href=http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap></a>
* "XML Encryption Syntax and Processing" section 5.6.2
* "CMS Triple DES Key Wrap".
* Note: only <code>CBC</code> mode and <code>NoPadding</code> padding
@ -159,9 +159,8 @@ public final class DESedeWrapCipher extends CipherSpi {
/**
* Initializes this cipher with a key and a source of randomness.
*
* <p>The cipher only supports the following two operation modes:<b>
* Cipher.WRAP_MODE, and <b>
* Cipher.UNWRAP_MODE.
* <p>The cipher only supports the following two operation modes:
* {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
* <p>For modes other than the above two, UnsupportedOperationException
* will be thrown.
* <p>If this cipher requires an initialization vector (IV), it will get
@ -192,9 +191,8 @@ public final class DESedeWrapCipher extends CipherSpi {
* Initializes this cipher with a key, a set of algorithm parameters,
* and a source of randomness.
*
* <p>The cipher only supports the following two operation modes:<b>
* Cipher.WRAP_MODE, and <b>
* Cipher.UNWRAP_MODE.
* <p>The cipher only supports the following two operation modes:
* {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
* <p>For modes other than the above two, UnsupportedOperationException
* will be thrown.
* <p>If this cipher requires an initialization vector (IV), it will get
@ -252,9 +250,8 @@ public final class DESedeWrapCipher extends CipherSpi {
* Initializes this cipher with a key, a set of algorithm parameters,
* and a source of randomness.
*
* <p>The cipher only supports the following two operation modes:<b>
* Cipher.WRAP_MODE, and <b>
* Cipher.UNWRAP_MODE.
* <p>The cipher only supports the following two operation modes:
* {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
* <p>For modes other than the above two, UnsupportedOperationException
* will be thrown.
* <p>If this cipher requires an initialization vector (IV), it will get
@ -360,15 +357,15 @@ public final class DESedeWrapCipher extends CipherSpi {
* current Cipher.engineInit(...) implementation,
* IllegalStateException will always be thrown upon invocation.
*
* @param in the input buffer.
* @param inOffset the offset in <code>in</code> where the input
* @param input the input buffer.
* @param inputOffset the offset in {@code input} where the input
* starts.
* @param inLen the input length.
* @param out the buffer for the result.
* @param outOffset the ofset in <code>out</code> where the result
* @param inputLen the input length.
* @param output the buffer for the result.
* @param outputOffset the ofset in {@code output} where the result
* is stored.
*
* @return the number of bytes stored in <code>out</code>.
* @return the number of bytes stored in {@code out}.
*
* @exception IllegalStateException upon invocation of this method.
*/

View File

@ -100,7 +100,7 @@ public final class DHKeyPairGenerator extends KeyPairGeneratorSpi {
* generator, and optionally the requested size in bits of the random
* exponent (private value).
*
* @param params the parameter set used to generate the key pair
* @param algParams the parameter set used to generate the key pair
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameters

View File

@ -92,7 +92,7 @@ extends AlgorithmParameterGeneratorSpi {
* generation values, which specify the size of the prime modulus and
* the size of the random exponent, both in bits.
*
* @param params the set of parameter generation values
* @param genParamSpec the set of parameter generation values
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameter

View File

@ -80,7 +80,7 @@ public final class PBEWithMD5AndDESCipher extends CipherSpi {
* Sets the padding mechanism of this cipher. This algorithm only uses
* PKCS #5 padding.
*
* @param padding the padding mechanism
* @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* is invalid

View File

@ -92,7 +92,7 @@ public final class PBEWithMD5AndTripleDESCipher extends CipherSpi {
* Sets the padding mechanism of this cipher. This algorithm only uses
* PKCS #5 padding.
*
* @param padding the padding mechanism
* @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* is invalid

View File

@ -75,7 +75,7 @@ public final class PBKDF2HmacSHA1Factory extends SecretKeyFactorySpi {
*
* @param key the key
*
* @param keySpec the requested format in which the key material shall be
* @param keySpecCl the requested format in which the key material shall be
* returned
*
* @return the underlying key specification (key material) in the

View File

@ -42,8 +42,8 @@ public class BufferedOutputStream extends FilterOutputStream {
/**
* The number of valid bytes in the buffer. This value is always
* in the range <tt>0</tt> through <tt>buf.length</tt>; elements
* <tt>buf[0]</tt> through <tt>buf[count-1]</tt> contain valid
* in the range {@code 0} through {@code buf.length}; elements
* {@code buf[0]} through {@code buf[count-1]} contain valid
* byte data.
*/
protected int count;

View File

@ -170,7 +170,7 @@ public class BufferedReader extends Reader {
* Reads a single character.
*
* @return The character read, as an integer in the range
* 0 to 65535 (<tt>0x00-0xffff</tt>), or -1 if the
* 0 to 65535 ({@code 0x00-0xffff}), or -1 if the
* end of the stream has been reached
* @exception IOException If an I/O error occurs
*/

View File

@ -34,7 +34,7 @@ package java.io;
* The default is large enough for most purposes.
*
* <p> A newLine() method is provided, which uses the platform's own notion of
* line separator as defined by the system property <tt>line.separator</tt>.
* line separator as defined by the system property {@code line.separator}.
* Not all platforms use the newline character ('\n') to terminate lines.
* Calling this method to terminate each output line is therefore preferred to
* writing a newline character directly.
@ -195,7 +195,7 @@ public class BufferedWriter extends Writer {
/**
* Writes a portion of a String.
*
* <p> If the value of the <tt>len</tt> parameter is negative then no
* <p> If the value of the {@code len} parameter is negative then no
* characters are written. This is contrary to the specification of this
* method in the {@linkplain java.io.Writer#write(java.lang.String,int,int)
* superclass}, which requires that an {@link IndexOutOfBoundsException} be
@ -225,7 +225,7 @@ public class BufferedWriter extends Writer {
/**
* Writes a line separator. The line separator string is defined by the
* system property <tt>line.separator</tt>, and is not necessarily a single
* system property {@code line.separator}, and is not necessarily a single
* newline ('\n') character.
*
* @exception IOException If an I/O error occurs

View File

@ -32,9 +32,9 @@ package java.io;
* counter keeps track of the next byte to
* be supplied by the <code>read</code> method.
* <p>
* Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
* Closing a {@code ByteArrayInputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>.
* generating an {@code IOException}.
*
* @author Arthur van Hoff
* @see java.io.StringBufferInputStream
@ -272,9 +272,9 @@ class ByteArrayInputStream extends InputStream {
}
/**
* Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
* Closing a {@code ByteArrayInputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>.
* generating an {@code IOException}.
*/
public void close() throws IOException {
}

View File

@ -31,12 +31,12 @@ import java.util.Arrays;
* This class implements an output stream in which the data is
* written into a byte array. The buffer automatically grows as data
* is written to it.
* The data can be retrieved using <code>toByteArray()</code> and
* <code>toString()</code>.
* The data can be retrieved using {@code toByteArray()} and
* {@code toString()}.
* <p>
* Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
* Closing a {@code ByteArrayOutputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>.
* generating an {@code IOException}.
*
* @author Arthur van Hoff
* @since 1.0
@ -138,8 +138,8 @@ public class ByteArrayOutputStream extends OutputStream {
}
/**
* Writes <code>len</code> bytes from the specified byte array
* starting at offset <code>off</code> to this byte array output stream.
* Writes {@code len} bytes from the specified byte array
* starting at offset {@code off} to this byte array output stream.
*
* @param b the data.
* @param off the start offset in the data.
@ -158,7 +158,7 @@ public class ByteArrayOutputStream extends OutputStream {
/**
* Writes the complete contents of this byte array output stream to
* the specified output stream argument, as if by calling the output
* stream's write method using <code>out.write(buf, 0, count)</code>.
* stream's write method using {@code out.write(buf, 0, count)}.
*
* @param out the output stream to which to write the data.
* @exception IOException if an I/O error occurs.
@ -168,7 +168,7 @@ public class ByteArrayOutputStream extends OutputStream {
}
/**
* Resets the <code>count</code> field of this byte array output
* Resets the {@code count} field of this byte array output
* stream to zero, so that all currently accumulated output in the
* output stream is discarded. The output stream can be used again,
* reusing the already allocated buffer space.
@ -194,7 +194,7 @@ public class ByteArrayOutputStream extends OutputStream {
/**
* Returns the current size of the buffer.
*
* @return the value of the <code>count</code> field, which is the number
* @return the value of the {@code count} field, which is the number
* of valid bytes in this output stream.
* @see java.io.ByteArrayOutputStream#count
*/
@ -204,7 +204,7 @@ public class ByteArrayOutputStream extends OutputStream {
/**
* Converts the buffer's contents into a string decoding bytes using the
* platform's default character set. The length of the new <tt>String</tt>
* platform's default character set. The length of the new {@code String}
* is a function of the character set, and hence may not be equal to the
* size of the buffer.
*
@ -224,7 +224,7 @@ public class ByteArrayOutputStream extends OutputStream {
/**
* Converts the buffer's contents into a string by decoding the bytes using
* the named {@link java.nio.charset.Charset charset}. The length of the new
* <tt>String</tt> is a function of the charset, and hence may not be equal
* {@code String} is a function of the charset, and hence may not be equal
* to the length of the byte array.
*
* <p> This method always replaces malformed-input and unmappable-character
@ -251,14 +251,14 @@ public class ByteArrayOutputStream extends OutputStream {
* copied into it. Each character <i>c</i> in the resulting string is
* constructed from the corresponding element <i>b</i> in the byte
* array such that:
* <blockquote><pre>
* c == (char)(((hibyte &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff))
* </pre></blockquote>
* <blockquote><pre>{@code
* c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))
* }</pre></blockquote>
*
* @deprecated This method does not properly convert bytes into characters.
* As of JDK&nbsp;1.1, the preferred way to do this is via the
* <code>toString(String enc)</code> method, which takes an encoding-name
* argument, or the <code>toString()</code> method, which uses the
* {@code toString(String enc)} method, which takes an encoding-name
* argument, or the {@code toString()} method, which uses the
* platform's default character encoding.
*
* @param hibyte the high byte of each resulting Unicode character.
@ -273,9 +273,9 @@ public class ByteArrayOutputStream extends OutputStream {
}
/**
* Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
* Closing a {@code ByteArrayOutputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>.
* generating an {@code IOException}.
*/
public void close() throws IOException {
}

View File

@ -62,13 +62,13 @@ public class CharArrayReader extends Reader {
* Creates a CharArrayReader from the specified array of chars.
*
* <p> The resulting reader will start reading at the given
* <tt>offset</tt>. The total number of <tt>char</tt> values that can be
* read from this reader will be either <tt>length</tt> or
* <tt>buf.length-offset</tt>, whichever is smaller.
* {@code offset}. The total number of {@code char} values that can be
* read from this reader will be either {@code length} or
* {@code buf.length-offset}, whichever is smaller.
*
* @throws IllegalArgumentException
* If <tt>offset</tt> is negative or greater than
* <tt>buf.length</tt>, or if <tt>length</tt> is negative, or if
* If {@code offset} is negative or greater than
* {@code buf.length}, or if {@code length} is negative, or if
* the sum of these two values is negative.
*
* @param buf Input buffer (not copied)

View File

@ -141,21 +141,21 @@ class CharArrayWriter extends Writer {
/**
* Appends the specified character sequence to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(csq)</tt>
* <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(csq.toString()) </pre>
*
* <p> Depending on the specification of <tt>toString</tt> for the
* character sequence <tt>csq</tt>, the entire sequence may not be
* appended. For instance, invoking the <tt>toString</tt> method of a
* <p> Depending on the specification of {@code toString} for the
* character sequence {@code csq}, the entire sequence may not be
* appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
* The character sequence to append. If <tt>csq</tt> is
* <tt>null</tt>, then the four characters <tt>"null"</tt> are
* The character sequence to append. If {@code csq} is
* {@code null}, then the four characters "{@code null}" are
* appended to this writer.
*
* @return This writer
@ -171,8 +171,9 @@ class CharArrayWriter extends Writer {
/**
* Appends a subsequence of the specified character sequence to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(csq, start,
* end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
* <p> An invocation of this method of the form
* {@code out.append(csq, start, end)} when
* {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
* <pre>
@ -180,9 +181,9 @@ class CharArrayWriter extends Writer {
*
* @param csq
* The character sequence from which a subsequence will be
* appended. If <tt>csq</tt> is <tt>null</tt>, then characters
* will be appended as if <tt>csq</tt> contained the four
* characters <tt>"null"</tt>.
* appended. If {@code csq} is {@code null}, then characters
* will be appended as if {@code csq} contained the four
* characters "{@code null}".
*
* @param start
* The index of the first character in the subsequence
@ -194,9 +195,9 @@ class CharArrayWriter extends Writer {
* @return This writer
*
* @throws IndexOutOfBoundsException
* If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
* is greater than <tt>end</tt>, or <tt>end</tt> is greater than
* <tt>csq.length()</tt>
* If {@code start} or {@code end} are negative, {@code start}
* is greater than {@code end}, or {@code end} is greater than
* {@code csq.length()}
*
* @since 1.5
*/
@ -209,7 +210,7 @@ class CharArrayWriter extends Writer {
/**
* Appends the specified character to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(c)</tt>
* <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>

View File

@ -47,7 +47,7 @@ import sun.nio.cs.StreamEncoder;
* If this virtual machine has a console then it is represented by a
* unique instance of this class which can be obtained by invoking the
* {@link java.lang.System#console()} method. If no console device is
* available then an invocation of that method will return <tt>null</tt>.
* available then an invocation of that method will return {@code null}.
* <p>
* Read and write operations are synchronized to guarantee the atomic
* completion of critical operations; therefore invoking methods
@ -56,17 +56,17 @@ import sun.nio.cs.StreamEncoder;
* on the objects returned by {@link #reader()} and {@link #writer()} may
* block in multithreaded scenarios.
* <p>
* Invoking <tt>close()</tt> on the objects returned by the {@link #reader()}
* Invoking {@code close()} on the objects returned by the {@link #reader()}
* and the {@link #writer()} will not close the underlying stream of those
* objects.
* <p>
* The console-read methods return <tt>null</tt> when the end of the
* The console-read methods return {@code null} when the end of the
* console input stream is reached, for example by typing control-D on
* Unix or control-Z on Windows. Subsequent read operations will succeed
* if additional characters are later entered on the console's input
* device.
* <p>
* Unless otherwise specified, passing a <tt>null</tt> argument to any method
* Unless otherwise specified, passing a {@code null} argument to any method
* in this class will cause a {@link NullPointerException} to be thrown.
* <p>
* <b>Security note:</b>
@ -107,7 +107,7 @@ public final class Console implements Flushable
* <p>
* This method is intended to be used by sophisticated applications, for
* example, a {@link java.util.Scanner} object which utilizes the rich
* parsing/scanning functionality provided by the <tt>Scanner</tt>:
* parsing/scanning functionality provided by the {@code Scanner}:
* <blockquote><pre>
* Console con = System.console();
* if (con != null) {
@ -117,7 +117,7 @@ public final class Console implements Flushable
* </pre></blockquote>
* <p>
* For simple applications requiring only line-oriented reading, use
* <tt>{@link #readLine}</tt>.
* {@link #readLine}.
* <p>
* The bulk read operations {@link java.io.Reader#read(char[]) read(char[]) },
* {@link java.io.Reader#read(char[], int, int) read(char[], int, int) } and
@ -126,8 +126,8 @@ public final class Console implements Flushable
* bound for each invocation, even if the destination buffer has space for
* more characters. The {@code Reader}'s {@code read} methods may block if a
* line bound has not been entered or reached on the console's input device.
* A line bound is considered to be any one of a line feed (<tt>'\n'</tt>),
* a carriage return (<tt>'\r'</tt>), a carriage return followed immediately
* A line bound is considered to be any one of a line feed ({@code '\n'}),
* a carriage return ({@code '\r'}), a carriage return followed immediately
* by a linefeed, or an end of stream.
*
* @return The reader associated with this console
@ -152,7 +152,7 @@ public final class Console implements Flushable
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws IllegalFormatException
@ -175,8 +175,9 @@ public final class Console implements Flushable
* A convenience method to write a formatted string to this console's
* output stream using the specified format string and arguments.
*
* <p> An invocation of this method of the form <tt>con.printf(format,
* args)</tt> behaves in exactly the same way as the invocation of
* <p> An invocation of this method of the form
* {@code con.printf(format, args)} behaves in exactly the same way
* as the invocation of
* <pre>con.format(format, args)</pre>.
*
* @param format
@ -191,7 +192,7 @@ public final class Console implements Flushable
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws IllegalFormatException
@ -237,7 +238,7 @@ public final class Console implements Flushable
* If an I/O error occurs.
*
* @return A string containing the line read from the console, not
* including any line-termination characters, or <tt>null</tt>
* including any line-termination characters, or {@code null}
* if an end of stream has been reached.
*/
public String readLine(String fmt, Object ... args) {
@ -265,7 +266,7 @@ public final class Console implements Flushable
* If an I/O error occurs.
*
* @return A string containing the line read from the console, not
* including any line-termination characters, or <tt>null</tt>
* including any line-termination characters, or {@code null}
* if an end of stream has been reached.
*/
public String readLine() {
@ -302,7 +303,7 @@ public final class Console implements Flushable
*
* @return A character array containing the password or passphrase read
* from the console, not including any line-termination characters,
* or <tt>null</tt> if an end of stream has been reached.
* or {@code null} if an end of stream has been reached.
*/
public char[] readPassword(String fmt, Object ... args) {
char[] passwd = null;
@ -346,7 +347,7 @@ public final class Console implements Flushable
*
* @return A character array containing the password or passphrase read
* from the console, not including any line-termination characters,
* or <tt>null</tt> if an end of stream has been reached.
* or {@code null} if an end of stream has been reached.
*/
public char[] readPassword() {
return readPassword("");

View File

@ -63,8 +63,8 @@ import sun.security.action.GetPropertyAction;
* pathname string, each name is separated from the next by a single copy of
* the default <em>separator character</em>. The default name-separator
* character is defined by the system property <code>file.separator</code>, and
* is made available in the public static fields <code>{@link
* #separator}</code> and <code>{@link #separatorChar}</code> of this class.
* is made available in the public static fields {@link
* #separator} and {@link #separatorChar} of this class.
* When a pathname string is converted into an abstract pathname, the names
* within it may be separated by the default name-separator character or by any
* other name-separator character that is supported by the underlying system.
@ -82,11 +82,11 @@ import sun.security.action.GetPropertyAction;
* <p> The <em>parent</em> of an abstract pathname may be obtained by invoking
* the {@link #getParent} method of this class and consists of the pathname's
* prefix and each name in the pathname's name sequence except for the last.
* Each directory's absolute pathname is an ancestor of any <tt>File</tt>
* Each directory's absolute pathname is an ancestor of any {@code File}
* object with an absolute abstract pathname which begins with the directory's
* absolute pathname. For example, the directory denoted by the abstract
* pathname <tt>"/usr"</tt> is an ancestor of the directory denoted by the
* pathname <tt>"/usr/local/bin"</tt>.
* pathname {@code "/usr"} is an ancestor of the directory denoted by the
* pathname {@code "/usr/local/bin"}.
*
* <p> The prefix concept is used to handle root directories on UNIX platforms,
* and drive specifiers, root directories and UNC pathnames on Microsoft Windows platforms,
@ -217,7 +217,7 @@ public class File
/**
* The system-dependent default name-separator character, represented as a
* string for convenience. This string contains a single character, namely
* <code>{@link #separatorChar}</code>.
* {@link #separatorChar}.
*/
public static final String separator = "" + separatorChar;
@ -236,7 +236,7 @@ public class File
/**
* The system-dependent path-separator character, represented as a string
* for convenience. This string contains a single character, namely
* <code>{@link #pathSeparatorChar}</code>.
* {@link #pathSeparatorChar}.
*/
public static final String pathSeparator = "" + pathSeparatorChar;
@ -374,33 +374,34 @@ public class File
}
/**
* Creates a new <tt>File</tt> instance by converting the given
* <tt>file:</tt> URI into an abstract pathname.
* Creates a new {@code File} instance by converting the given
* {@code file:} URI into an abstract pathname.
*
* <p> The exact form of a <tt>file:</tt> URI is system-dependent, hence
* <p> The exact form of a {@code file:} URI is system-dependent, hence
* the transformation performed by this constructor is also
* system-dependent.
*
* <p> For a given abstract pathname <i>f</i> it is guaranteed that
*
* <blockquote><tt>
* new File(</tt><i>&nbsp;f</i><tt>.{@link #toURI() toURI}()).equals(</tt><i>&nbsp;f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
* </tt></blockquote>
* <blockquote><code>
* new File(</code><i>&nbsp;f</i><code>.{@link #toURI()
* toURI}()).equals(</code><i>&nbsp;f</i><code>.{@link #getAbsoluteFile() getAbsoluteFile}())
* </code></blockquote>
*
* so long as the original abstract pathname, the URI, and the new abstract
* pathname are all created in (possibly different invocations of) the same
* Java virtual machine. This relationship typically does not hold,
* however, when a <tt>file:</tt> URI that is created in a virtual machine
* however, when a {@code file:} URI that is created in a virtual machine
* on one operating system is converted into an abstract pathname in a
* virtual machine on a different operating system.
*
* @param uri
* An absolute, hierarchical URI with a scheme equal to
* <tt>"file"</tt>, a non-empty path component, and undefined
* {@code "file"}, a non-empty path component, and undefined
* authority, query, and fragment components
*
* @throws NullPointerException
* If <tt>uri</tt> is <tt>null</tt>
* If {@code uri} is {@code null}
*
* @throws IllegalArgumentException
* If the preconditions on the parameter do not hold
@ -533,7 +534,7 @@ public class File
* Returns the absolute pathname string of this abstract pathname.
*
* <p> If this abstract pathname is already absolute, then the pathname
* string is simply returned as if by the <code>{@link #getPath}</code>
* string is simply returned as if by the {@link #getPath}
* method. If this abstract pathname is the empty abstract pathname then
* the pathname string of the current user directory, which is named by the
* system property <code>user.dir</code>, is returned. Otherwise this
@ -581,7 +582,7 @@ public class File
* converts this pathname to absolute form if necessary, as if by invoking the
* {@link #getAbsolutePath} method, and then maps it to its unique form in a
* system-dependent way. This typically involves removing redundant names
* such as <tt>"."</tt> and <tt>".."</tt> from the pathname, resolving
* such as {@code "."} and {@code ".."} from the pathname, resolving
* symbolic links (on UNIX platforms), and converting drive letters to a
* standard case (on Microsoft Windows platforms).
*
@ -604,8 +605,8 @@ public class File
*
* @throws SecurityException
* If a required system property value cannot be accessed, or
* if a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead}</code> method denies
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkRead} method denies
* read access to the file
*
* @since 1.1
@ -632,8 +633,8 @@ public class File
*
* @throws SecurityException
* If a required system property value cannot be accessed, or
* if a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead}</code> method denies
* if a security manager exists and its {@link
* java.lang.SecurityManager#checkRead} method denies
* read access to the file
*
* @since 1.2
@ -687,7 +688,7 @@ public class File
}
/**
* Constructs a <tt>file:</tt> URI that represents this abstract pathname.
* Constructs a {@code file:} URI that represents this abstract pathname.
*
* <p> The exact form of the URI is system-dependent. If it can be
* determined that the file denoted by this abstract pathname is a
@ -695,15 +696,16 @@ public class File
*
* <p> For a given abstract pathname <i>f</i>, it is guaranteed that
*
* <blockquote><tt>
* new {@link #File(java.net.URI) File}(</tt><i>&nbsp;f</i><tt>.toURI()).equals(</tt><i>&nbsp;f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
* </tt></blockquote>
* <blockquote><code>
* new {@link #File(java.net.URI) File}(</code><i>&nbsp;f</i><code>.toURI()).equals(
* </code><i>&nbsp;f</i><code>.{@link #getAbsoluteFile() getAbsoluteFile}())
* </code></blockquote>
*
* so long as the original abstract pathname, the URI, and the new abstract
* pathname are all created in (possibly different invocations of) the same
* Java virtual machine. Due to the system-dependent nature of abstract
* pathnames, however, this relationship typically does not hold when a
* <tt>file:</tt> URI that is created in a virtual machine on one operating
* {@code file:} URI that is created in a virtual machine on one operating
* system is converted into an abstract pathname in a virtual machine on a
* different operating system.
*
@ -716,7 +718,7 @@ public class File
* may be used to obtain a {@code Path} representing this abstract pathname.
*
* @return An absolute, hierarchical URI with a scheme equal to
* <tt>"file"</tt>, a path representing this abstract pathname,
* {@code "file"}, a path representing this abstract pathname,
* and undefined authority, query, and fragment components
* @throws SecurityException If a required system property value cannot
* be accessed.
@ -753,8 +755,8 @@ public class File
* application; <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public boolean canRead() {
@ -781,8 +783,8 @@ public class File
* <code>false</code> otherwise.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*/
public boolean canWrite() {
@ -804,8 +806,8 @@ public class File
* by this abstract pathname exists; <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file or directory
*/
public boolean exists() {
@ -834,8 +836,8 @@ public class File
* <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public boolean isDirectory() {
@ -867,8 +869,8 @@ public class File
* <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public boolean isFile() {
@ -894,8 +896,8 @@ public class File
* underlying platform
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*
* @since 1.2
@ -928,8 +930,8 @@ public class File
* file does not exist or if an I/O error occurs
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public long lastModified() {
@ -959,8 +961,8 @@ public class File
* denoting system-dependent entities such as devices or pipes.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public long length() {
@ -997,8 +999,8 @@ public class File
* If an I/O error occurred
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.2
@ -1026,8 +1028,8 @@ public class File
* successfully deleted; <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkDelete}</code> method denies
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkDelete} method denies
* delete access to the file
*/
public boolean delete() {
@ -1060,8 +1062,8 @@ public class File
* facility should be used instead.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkDelete}</code> method denies
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkDelete} method denies
* delete access to the file
*
* @see #delete
@ -1301,8 +1303,8 @@ public class File
* created; <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not permit the named directory to be created
*/
public boolean mkdir() {
@ -1327,12 +1329,12 @@ public class File
* otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkRead(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkRead(java.lang.String)}
* method does not permit verification of the existence of the
* named directory and all necessary parent directories; or if
* the <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* the {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not permit the named directory and all necessary
* parent directories to be created
*/
@ -1375,8 +1377,8 @@ public class File
* <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to either the old or new pathnames
*
* @throws NullPointerException
@ -1405,7 +1407,7 @@ public class File
* but some provide more precision. The argument will be truncated to fit
* the supported precision. If the operation succeeds and no intervening
* operations on the file take place, then the next invocation of the
* <code>{@link #lastModified}</code> method will return the (possibly
* {@link #lastModified} method will return the (possibly
* truncated) <code>time</code> argument that was passed to this method.
*
* @param time The new last-modified time, measured in milliseconds since
@ -1417,8 +1419,8 @@ public class File
* @throws IllegalArgumentException If the argument is negative
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the named file
*
* @since 1.2
@ -1448,8 +1450,8 @@ public class File
* <code>false</code> otherwise
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the named file
*
* @since 1.2
@ -1491,8 +1493,8 @@ public class File
* the access permissions of this abstract pathname.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the named file
*
* @since 1.6
@ -1514,11 +1516,12 @@ public class File
* machine with special privileges that allow it to modify files that
* disallow write operations.
*
* <p> An invocation of this method of the form <tt>file.setWritable(arg)</tt>
* <p> An invocation of this method of the form {@code file.setWritable(arg)}
* behaves in exactly the same way as the invocation
*
* <pre>
* file.setWritable(arg, true) </pre>
* <pre>{@code
* file.setWritable(arg, true)
* }</pre>
*
* @param writable
* If <code>true</code>, sets the access permission to allow write
@ -1529,8 +1532,8 @@ public class File
* change the access permissions of this abstract pathname.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@ -1568,8 +1571,8 @@ public class File
* operation will fail.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@ -1591,11 +1594,12 @@ public class File
* machine with special privileges that allow it to read files that are
* marked as unreadable.
*
* <p>An invocation of this method of the form <tt>file.setReadable(arg)</tt>
* <p>An invocation of this method of the form {@code file.setReadable(arg)}
* behaves in exactly the same way as the invocation
*
* <pre>
* file.setReadable(arg, true) </pre>
* <pre>{@code
* file.setReadable(arg, true)
* }</pre>
*
* @param readable
* If <code>true</code>, sets the access permission to allow read
@ -1609,8 +1613,8 @@ public class File
* operation will fail.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@ -1648,8 +1652,8 @@ public class File
* operation will fail.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@ -1671,11 +1675,12 @@ public class File
* virtual machine with special privileges that allow it to execute files
* that are not marked executable.
*
* <p>An invocation of this method of the form <tt>file.setExcutable(arg)</tt>
* <p>An invocation of this method of the form {@code file.setExcutable(arg)}
* behaves in exactly the same way as the invocation
*
* <pre>
* file.setExecutable(arg, true) </pre>
* <pre>{@code
* file.setExecutable(arg, true)
* }</pre>
*
* @param executable
* If <code>true</code>, sets the access permission to allow execute
@ -1689,8 +1694,8 @@ public class File
* operation will fail.
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@ -1710,8 +1715,8 @@ public class File
* <em>and</em> the application is allowed to execute the file
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkExec(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkExec(java.lang.String)}
* method denies execute access to the file
*
* @since 1.6
@ -1783,12 +1788,12 @@ public class File
* Returns the size of the partition <a href="#partName">named</a> by this
* abstract pathname.
*
* @return The size, in bytes, of the partition or <tt>0L</tt> if this
* @return The size, in bytes, of the partition or {@code 0L} if this
* abstract pathname does not name a partition
*
* @throws SecurityException
* If a security manager has been installed and it denies
* {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt>
* {@link RuntimePermission}{@code ("getFileSystemAttributes")}
* or its {@link SecurityManager#checkRead(String)} method denies
* read access to the file named by this abstract pathname
*
@ -1819,14 +1824,14 @@ public class File
* makes no guarantee that write operations to this file system
* will succeed.
*
* @return The number of unallocated bytes on the partition or <tt>0L</tt>
* @return The number of unallocated bytes on the partition or {@code 0L}
* if the abstract pathname does not name a partition. This
* value will be less than or equal to the total file system size
* returned by {@link #getTotalSpace}.
*
* @throws SecurityException
* If a security manager has been installed and it denies
* {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt>
* {@link RuntimePermission}{@code ("getFileSystemAttributes")}
* or its {@link SecurityManager#checkRead(String)} method denies
* read access to the file named by this abstract pathname
*
@ -1860,14 +1865,14 @@ public class File
* virtual machine. This method makes no guarantee that write operations
* to this file system will succeed.
*
* @return The number of available bytes on the partition or <tt>0L</tt>
* @return The number of available bytes on the partition or {@code 0L}
* if the abstract pathname does not name a partition. On
* systems where this information is not available, this method
* will be equivalent to a call to {@link #getFreeSpace}.
*
* @throws SecurityException
* If a security manager has been installed and it denies
* {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt>
* {@link RuntimePermission}{@code ("getFileSystemAttributes")}
* or its {@link SecurityManager#checkRead(String)} method denies
* read access to the file named by this abstract pathname
*
@ -1939,7 +1944,7 @@ public class File
*
* This method provides only part of a temporary-file facility. To arrange
* for a file created by this method to be deleted automatically, use the
* <code>{@link #deleteOnExit}</code> method.
* {@link #deleteOnExit} method.
*
* <p> The <code>prefix</code> argument must be at least three characters
* long. It is recommended that the prefix be a short, meaningful string
@ -1987,8 +1992,8 @@ public class File
* @throws IOException If a file could not be created
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not allow a file to be created
*
* @since 1.2
@ -2032,9 +2037,9 @@ public class File
/**
* Creates an empty file in the default temporary-file directory, using
* the given prefix and suffix to generate its name. Invoking this method
* is equivalent to invoking <code>{@link #createTempFile(java.lang.String,
* is equivalent to invoking {@link #createTempFile(java.lang.String,
* java.lang.String, java.io.File)
* createTempFile(prefix,&nbsp;suffix,&nbsp;null)}</code>.
* createTempFile(prefix,&nbsp;suffix,&nbsp;null)}.
*
* <p> The {@link
* java.nio.file.Files#createTempFile(String,String,java.nio.file.attribute.FileAttribute[])
@ -2059,8 +2064,8 @@ public class File
* @throws IOException If a file could not be created
*
* @throws SecurityException
* If a security manager exists and its <code>{@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
* If a security manager exists and its {@link
* java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not allow a file to be created
*
* @since 1.2
@ -2136,7 +2141,7 @@ public class File
/**
* Returns the pathname string of this abstract pathname. This is just the
* string returned by the <code>{@link #getPath}</code> method.
* string returned by the {@link #getPath} method.
*
* @return The string form of this abstract pathname
*/

View File

@ -37,7 +37,7 @@ import sun.nio.ch.FileChannelImpl;
* <code>File</code> or to a <code>FileDescriptor</code>. Whether or not
* a file is available or may be created depends upon the underlying
* platform. Some platforms, in particular, allow a file to be opened
* for writing by only one <tt>FileOutputStream</tt> (or other
* for writing by only one {@code FileOutputStream} (or other
* file-writing object) at a time. In such situations the constructors in
* this class will fail if the file involved is already open.
*

View File

@ -32,9 +32,9 @@ package java.io;
* size are appropriate. To specify these values yourself, construct an
* InputStreamReader on a FileInputStream.
*
* <p><code>FileReader</code> is meant for reading streams of characters.
* <p>{@code FileReader} is meant for reading streams of characters.
* For reading streams of raw bytes, consider using a
* <code>FileInputStream</code>.
* {@code FileInputStream}.
*
* @see InputStreamReader
* @see FileInputStream
@ -45,7 +45,7 @@ package java.io;
public class FileReader extends InputStreamReader {
/**
* Creates a new <tt>FileReader</tt>, given the name of the
* Creates a new {@code FileReader}, given the name of the
* file to read from.
*
* @param fileName the name of the file to read from
@ -59,10 +59,10 @@ public class FileReader extends InputStreamReader {
}
/**
* Creates a new <tt>FileReader</tt>, given the <tt>File</tt>
* Creates a new {@code FileReader}, given the {@code File}
* to read from.
*
* @param file the <tt>File</tt> to read from
* @param file the {@code File} to read from
* @exception FileNotFoundException if the file does not exist,
* is a directory rather than a regular file,
* or for some other reason cannot be opened for
@ -73,8 +73,8 @@ public class FileReader extends InputStreamReader {
}
/**
* Creates a new <tt>FileReader</tt>, given the
* <tt>FileDescriptor</tt> to read from.
* Creates a new {@code FileReader}, given the
* {@code FileDescriptor} to read from.
*
* @param fd the FileDescriptor to read from
*/

View File

@ -34,13 +34,13 @@ package java.io;
*
* <p>Whether or not a file is available or may be created depends upon the
* underlying platform. Some platforms, in particular, allow a file to be
* opened for writing by only one <tt>FileWriter</tt> (or other file-writing
* opened for writing by only one {@code FileWriter} (or other file-writing
* object) at a time. In such situations the constructors in this class
* will fail if the file involved is already open.
*
* <p><code>FileWriter</code> is meant for writing streams of characters.
* <p>{@code FileWriter} is meant for writing streams of characters.
* For writing streams of raw bytes, consider using a
* <code>FileOutputStream</code>.
* {@code FileOutputStream}.
*
* @see OutputStreamWriter
* @see FileOutputStream
@ -68,7 +68,7 @@ public class FileWriter extends OutputStreamWriter {
* indicating whether or not to append the data written.
*
* @param fileName String The system-dependent filename.
* @param append boolean if <code>true</code>, then data will be written
* @param append boolean if {@code true}, then data will be written
* to the end of the file rather than the beginning.
* @throws IOException if the named file exists but is a directory rather
* than a regular file, does not exist but cannot be
@ -92,11 +92,11 @@ public class FileWriter extends OutputStreamWriter {
/**
* Constructs a FileWriter object given a File object. If the second
* argument is <code>true</code>, then bytes will be written to the end
* argument is {@code true}, then bytes will be written to the end
* of the file rather than the beginning.
*
* @param file a File object to write to
* @param append if <code>true</code>, then bytes will be written
* @param append if {@code true}, then bytes will be written
* to the end of the file rather than the beginning
* @throws IOException if the file exists but is a directory rather than
* a regular file, does not exist but cannot be created,

View File

@ -57,7 +57,7 @@ public class FilterOutputStream extends OutputStream {
* underlying output stream.
*
* @param out the underlying output stream to be assigned to
* the field <tt>this.out</tt> for later use, or
* the field {@code this.out} for later use, or
* <code>null</code> if this instance is to be
* created without an underlying stream.
*/
@ -70,9 +70,9 @@ public class FilterOutputStream extends OutputStream {
* <p>
* The <code>write</code> method of <code>FilterOutputStream</code>
* calls the <code>write</code> method of its underlying output stream,
* that is, it performs <tt>out.write(b)</tt>.
* that is, it performs {@code out.write(b)}.
* <p>
* Implements the abstract <tt>write</tt> method of <tt>OutputStream</tt>.
* Implements the abstract {@code write} method of {@code OutputStream}.
*
* @param b the <code>byte</code>.
* @exception IOException if an I/O error occurs.

View File

@ -28,7 +28,7 @@ package java.io;
import java.io.IOException;
/**
* A <tt>Flushable</tt> is a destination of data that can be flushed. The
* A {@code Flushable} is a destination of data that can be flushed. The
* flush method is invoked to write any buffered output to the underlying
* stream.
*

View File

@ -35,11 +35,11 @@ public class IOError extends Error {
/**
* Constructs a new instance of IOError with the specified cause. The
* IOError is created with the detail message of
* <tt>(cause==null ? null : cause.toString())</tt> (which typically
* {@code (cause==null ? null : cause.toString())} (which typically
* contains the class and detail message of cause).
*
* @param cause
* The cause of this error, or <tt>null</tt> if the cause
* The cause of this error, or {@code null} if the cause
* is not known
*/
public IOError(Throwable cause) {

View File

@ -34,10 +34,10 @@ package java.io;
*
* <p> By default, line numbering begins at 0. This number increments at every
* <a href="#lt">line terminator</a> as the data is read, and can be changed
* with a call to <tt>setLineNumber(int)</tt>. Note however, that
* <tt>setLineNumber(int)</tt> does not actually change the current position in
* with a call to {@code setLineNumber(int)}. Note however, that
* {@code setLineNumber(int)} does not actually change the current position in
* the stream; it only changes the value that will be returned by
* <tt>getLineNumber()</tt>.
* {@code getLineNumber()}.
*
* <p> A line is considered to be <a name="lt">terminated</a> by any one of a
* line feed ('\n'), a carriage return ('\r'), or a carriage return followed
@ -193,7 +193,7 @@ public class LineNumberReader extends BufferedReader {
*
* @return A String containing the contents of the line, not including
* any <a href="#lt">line termination characters</a>, or
* <tt>null</tt> if the end of the stream has been reached
* {@code null} if the end of the stream has been reached
*
* @throws IOException
* If an I/O error occurs
@ -226,7 +226,7 @@ public class LineNumberReader extends BufferedReader {
* If an I/O error occurs
*
* @throws IllegalArgumentException
* If <tt>n</tt> is negative
* If {@code n} is negative
*/
public long skip(long n) throws IOException {
if (n < 0)

View File

@ -94,7 +94,7 @@ public abstract class OutputStream implements Closeable, Flushable {
* <p>
* If <code>off</code> is negative, or <code>len</code> is negative, or
* <code>off+len</code> is greater than the length of the array
* <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
* {@code b}, then an {@code IndexOutOfBoundsException} is thrown.
*
* @param b the data.
* @param off the start offset in the data.

View File

@ -53,7 +53,7 @@ import sun.nio.cs.StreamEncoder;
* </pre>
*
* <p> A <i>surrogate pair</i> is a character represented by a sequence of two
* <tt>char</tt> values: A <i>high</i> surrogate in the range '&#92;uD800' to
* {@code char} values: A <i>high</i> surrogate in the range '&#92;uD800' to
* '&#92;uDBFF' followed by a <i>low</i> surrogate in the range '&#92;uDC00' to
* '&#92;uDFFF'.
*
@ -161,7 +161,7 @@ public class OutputStreamWriter extends Writer {
* <p> If this instance was created with the {@link
* #OutputStreamWriter(OutputStream, String)} constructor then the returned
* name, being unique for the encoding, may differ from the name passed to
* the constructor. This method may return <tt>null</tt> if the stream has
* the constructor. This method may return {@code null} if the stream has
* been closed. </p>
*
* @return The historical name of this encoding, or possibly

View File

@ -32,22 +32,22 @@ import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
/**
* A <code>PrintStream</code> adds functionality to another output stream,
* A {@code PrintStream} adds functionality to another output stream,
* namely the ability to print representations of various data values
* conveniently. Two other features are provided as well. Unlike other output
* streams, a <code>PrintStream</code> never throws an
* <code>IOException</code>; instead, exceptional situations merely set an
* internal flag that can be tested via the <code>checkError</code> method.
* Optionally, a <code>PrintStream</code> can be created so as to flush
* automatically; this means that the <code>flush</code> method is
* streams, a {@code PrintStream} never throws an
* {@code IOException}; instead, exceptional situations merely set an
* internal flag that can be tested via the {@code checkError} method.
* Optionally, a {@code PrintStream} can be created so as to flush
* automatically; this means that the {@code flush} method is
* automatically invoked after a byte array is written, one of the
* <code>println</code> methods is invoked, or a newline character or byte
* (<code>'\n'</code>) is written.
* {@code println} methods is invoked, or a newline character or byte
* ({@code '\n'}) is written.
*
* <p> All characters printed by a <code>PrintStream</code> are converted into
* bytes using the platform's default character encoding. The <code>{@link
* PrintWriter}</code> class should be used in situations that require writing
* characters rather than bytes.
* <p> All characters printed by a {@code PrintStream} are converted into
* bytes using the platform's default character encoding.
* The {@link PrintWriter} class should be used in situations that require
* writing characters rather than bytes.
*
* @author Frank Yellin
* @author Mark Reinhold
@ -142,8 +142,8 @@ public class PrintStream extends FilterOutputStream
* printed
* @param autoFlush A boolean; if true, the output buffer will be flushed
* whenever a byte array is written, one of the
* <code>println</code> methods is invoked, or a newline
* character or byte (<code>'\n'</code>) is written
* {@code println} methods is invoked, or a newline
* character or byte ({@code '\n'}) is written
*
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean)
*/
@ -158,8 +158,8 @@ public class PrintStream extends FilterOutputStream
* printed
* @param autoFlush A boolean; if true, the output buffer will be flushed
* whenever a byte array is written, one of the
* <code>println</code> methods is invoked, or a newline
* character or byte (<code>'\n'</code>) is written
* {@code println} methods is invoked, or a newline
* character or byte ({@code '\n'}) is written
* @param encoding The name of a supported
* <a href="../lang/package-summary.html#charenc">
* character encoding</a>
@ -371,21 +371,21 @@ public class PrintStream extends FilterOutputStream
/**
* Flushes the stream and checks its error state. The internal error state
* is set to <code>true</code> when the underlying output stream throws an
* <code>IOException</code> other than <code>InterruptedIOException</code>,
* and when the <code>setError</code> method is invoked. If an operation
* is set to {@code true} when the underlying output stream throws an
* {@code IOException} other than {@code InterruptedIOException},
* and when the {@code setError} method is invoked. If an operation
* on the underlying output stream throws an
* <code>InterruptedIOException</code>, then the <code>PrintStream</code>
* {@code InterruptedIOException}, then the {@code PrintStream}
* converts the exception back into an interrupt by doing:
* <pre>
* <pre>{@code
* Thread.currentThread().interrupt();
* </pre>
* }</pre>
* or the equivalent.
*
* @return <code>true</code> if and only if this stream has encountered an
* <code>IOException</code> other than
* <code>InterruptedIOException</code>, or the
* <code>setError</code> method has been invoked
* @return {@code true} if and only if this stream has encountered an
* {@code IOException} other than
* {@code InterruptedIOException}, or the
* {@code setError} method has been invoked
*/
public boolean checkError() {
if (out != null)
@ -398,11 +398,11 @@ public class PrintStream extends FilterOutputStream
}
/**
* Sets the error state of the stream to <code>true</code>.
* Sets the error state of the stream to {@code true}.
*
* <p> This method will cause subsequent invocations of {@link
* #checkError()} to return <tt>true</tt> until {@link
* #clearError()} is invoked.
* #checkError()} to return {@code true} until
* {@link #clearError()} is invoked.
*
* @since 1.1
*/
@ -414,7 +414,7 @@ public class PrintStream extends FilterOutputStream
* Clears the internal error state of this stream.
*
* <p> This method will cause subsequent invocations of {@link
* #checkError()} to return <tt>false</tt> until another write
* #checkError()} to return {@code false} until another write
* operation fails and invokes {@link #setError()}.
*
* @since 1.6
@ -430,12 +430,12 @@ public class PrintStream extends FilterOutputStream
/**
* Writes the specified byte to this stream. If the byte is a newline and
* automatic flushing is enabled then the <code>flush</code> method will be
* automatic flushing is enabled then the {@code flush} method will be
* invoked.
*
* <p> Note that the byte is written as given; to write a character that
* will be translated according to the platform's default character
* encoding, use the <code>print(char)</code> or <code>println(char)</code>
* encoding, use the {@code print(char)} or {@code println(char)}
* methods.
*
* @param b The byte to be written
@ -460,13 +460,13 @@ public class PrintStream extends FilterOutputStream
}
/**
* Writes <code>len</code> bytes from the specified byte array starting at
* offset <code>off</code> to this stream. If automatic flushing is
* enabled then the <code>flush</code> method will be invoked.
* Writes {@code len} bytes from the specified byte array starting at
* offset {@code off} to this stream. If automatic flushing is
* enabled then the {@code flush} method will be invoked.
*
* <p> Note that the bytes will be written as given; to write characters
* that will be translated according to the platform's default character
* encoding, use the <code>print(char)</code> or <code>println(char)</code>
* encoding, use the {@code print(char)} or {@code println(char)}
* methods.
*
* @param buf A byte array
@ -559,13 +559,13 @@ public class PrintStream extends FilterOutputStream
/* Methods that do not terminate lines */
/**
* Prints a boolean value. The string produced by <code>{@link
* java.lang.String#valueOf(boolean)}</code> is translated into bytes
* Prints a boolean value. The string produced by {@link
* java.lang.String#valueOf(boolean)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param b The <code>boolean</code> to be printed
* @param b The {@code boolean} to be printed
*/
public void print(boolean b) {
write(b ? "true" : "false");
@ -575,22 +575,22 @@ public class PrintStream extends FilterOutputStream
* Prints a character. The character is translated into one or more bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param c The <code>char</code> to be printed
* @param c The {@code char} to be printed
*/
public void print(char c) {
write(String.valueOf(c));
}
/**
* Prints an integer. The string produced by <code>{@link
* java.lang.String#valueOf(int)}</code> is translated into bytes
* Prints an integer. The string produced by {@link
* java.lang.String#valueOf(int)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param i The <code>int</code> to be printed
* @param i The {@code int} to be printed
* @see java.lang.Integer#toString(int)
*/
public void print(int i) {
@ -598,13 +598,13 @@ public class PrintStream extends FilterOutputStream
}
/**
* Prints a long integer. The string produced by <code>{@link
* java.lang.String#valueOf(long)}</code> is translated into bytes
* Prints a long integer. The string produced by {@link
* java.lang.String#valueOf(long)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param l The <code>long</code> to be printed
* @param l The {@code long} to be printed
* @see java.lang.Long#toString(long)
*/
public void print(long l) {
@ -612,13 +612,13 @@ public class PrintStream extends FilterOutputStream
}
/**
* Prints a floating-point number. The string produced by <code>{@link
* java.lang.String#valueOf(float)}</code> is translated into bytes
* Prints a floating-point number. The string produced by {@link
* java.lang.String#valueOf(float)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param f The <code>float</code> to be printed
* @param f The {@code float} to be printed
* @see java.lang.Float#toString(float)
*/
public void print(float f) {
@ -627,12 +627,12 @@ public class PrintStream extends FilterOutputStream
/**
* Prints a double-precision floating-point number. The string produced by
* <code>{@link java.lang.String#valueOf(double)}</code> is translated into
* {@link java.lang.String#valueOf(double)} is translated into
* bytes according to the platform's default character encoding, and these
* bytes are written in exactly the manner of the <code>{@link
* #write(int)}</code> method.
* bytes are written in exactly the manner of the {@link
* #write(int)} method.
*
* @param d The <code>double</code> to be printed
* @param d The {@code double} to be printed
* @see java.lang.Double#toString(double)
*/
public void print(double d) {
@ -643,24 +643,24 @@ public class PrintStream extends FilterOutputStream
* Prints an array of characters. The characters are converted into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param s The array of chars to be printed
*
* @throws NullPointerException If <code>s</code> is <code>null</code>
* @throws NullPointerException If {@code s} is {@code null}
*/
public void print(char s[]) {
write(s);
}
/**
* Prints a string. If the argument is <code>null</code> then the string
* <code>"null"</code> is printed. Otherwise, the string's characters are
* Prints a string. If the argument is {@code null} then the string
* {@code "null"} is printed. Otherwise, the string's characters are
* converted into bytes according to the platform's default character
* encoding, and these bytes are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param s The <code>String</code> to be printed
* @param s The {@code String} to be printed
*/
public void print(String s) {
if (s == null) {
@ -670,13 +670,13 @@ public class PrintStream extends FilterOutputStream
}
/**
* Prints an object. The string produced by the <code>{@link
* java.lang.String#valueOf(Object)}</code> method is translated into bytes
* Prints an object. The string produced by the {@link
* java.lang.String#valueOf(Object)} method is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param obj The <code>Object</code> to be printed
* @param obj The {@code Object} to be printed
* @see java.lang.Object#toString()
*/
public void print(Object obj) {
@ -689,8 +689,8 @@ public class PrintStream extends FilterOutputStream
/**
* Terminates the current line by writing the line separator string. The
* line separator string is defined by the system property
* <code>line.separator</code>, and is not necessarily a single newline
* character (<code>'\n'</code>).
* {@code line.separator}, and is not necessarily a single newline
* character ({@code '\n'}).
*/
public void println() {
newLine();
@ -698,10 +698,10 @@ public class PrintStream extends FilterOutputStream
/**
* Prints a boolean and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(boolean)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(boolean)} and then
* {@link #println()}.
*
* @param x The <code>boolean</code> to be printed
* @param x The {@code boolean} to be printed
*/
public void println(boolean x) {
synchronized (this) {
@ -712,10 +712,10 @@ public class PrintStream extends FilterOutputStream
/**
* Prints a character and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(char)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(char)} and then
* {@link #println()}.
*
* @param x The <code>char</code> to be printed.
* @param x The {@code char} to be printed.
*/
public void println(char x) {
synchronized (this) {
@ -726,10 +726,10 @@ public class PrintStream extends FilterOutputStream
/**
* Prints an integer and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(int)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(int)} and then
* {@link #println()}.
*
* @param x The <code>int</code> to be printed.
* @param x The {@code int} to be printed.
*/
public void println(int x) {
synchronized (this) {
@ -740,10 +740,10 @@ public class PrintStream extends FilterOutputStream
/**
* Prints a long and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(long)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(long)} and then
* {@link #println()}.
*
* @param x a The <code>long</code> to be printed.
* @param x a The {@code long} to be printed.
*/
public void println(long x) {
synchronized (this) {
@ -754,10 +754,10 @@ public class PrintStream extends FilterOutputStream
/**
* Prints a float and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(float)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(float)} and then
* {@link #println()}.
*
* @param x The <code>float</code> to be printed.
* @param x The {@code float} to be printed.
*/
public void println(float x) {
synchronized (this) {
@ -768,10 +768,10 @@ public class PrintStream extends FilterOutputStream
/**
* Prints a double and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(double)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(double)} and then
* {@link #println()}.
*
* @param x The <code>double</code> to be printed.
* @param x The {@code double} to be printed.
*/
public void println(double x) {
synchronized (this) {
@ -782,8 +782,8 @@ public class PrintStream extends FilterOutputStream
/**
* Prints an array of characters and then terminate the line. This method
* behaves as though it invokes <code>{@link #print(char[])}</code> and
* then <code>{@link #println()}</code>.
* behaves as though it invokes {@link #print(char[])} and
* then {@link #println()}.
*
* @param x an array of chars to print.
*/
@ -796,10 +796,10 @@ public class PrintStream extends FilterOutputStream
/**
* Prints a String and then terminate the line. This method behaves as
* though it invokes <code>{@link #print(String)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(String)} and then
* {@link #println()}.
*
* @param x The <code>String</code> to be printed.
* @param x The {@code String} to be printed.
*/
public void println(String x) {
synchronized (this) {
@ -812,10 +812,10 @@ public class PrintStream extends FilterOutputStream
* Prints an Object and then terminate the line. This method calls
* at first String.valueOf(x) to get the printed object's string value,
* then behaves as
* though it invokes <code>{@link #print(String)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(String)} and then
* {@link #println()}.
*
* @param x The <code>Object</code> to be printed.
* @param x The {@code Object} to be printed.
*/
public void println(Object x) {
String s = String.valueOf(x);
@ -830,11 +830,13 @@ public class PrintStream extends FilterOutputStream
* A convenience method to write a formatted string to this output stream
* using the specified format string and arguments.
*
* <p> An invocation of this method of the form <tt>out.printf(format,
* args)</tt> behaves in exactly the same way as the invocation
* <p> An invocation of this method of the form
* {@code out.printf(format, args)} behaves
* in exactly the same way as the invocation
*
* <pre>
* out.format(format, args) </pre>
* <pre>{@code
* out.format(format, args)
* }</pre>
*
* @param format
* A format string as described in <a
@ -848,7 +850,7 @@ public class PrintStream extends FilterOutputStream
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -861,7 +863,7 @@ public class PrintStream extends FilterOutputStream
* formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This output stream
*
@ -875,15 +877,17 @@ public class PrintStream extends FilterOutputStream
* A convenience method to write a formatted string to this output stream
* using the specified format string and arguments.
*
* <p> An invocation of this method of the form <tt>out.printf(l, format,
* args)</tt> behaves in exactly the same way as the invocation
* <p> An invocation of this method of the form
* {@code out.printf(l, format, args)} behaves
* in exactly the same way as the invocation
*
* <pre>
* out.format(l, format, args) </pre>
* <pre>{@code
* out.format(l, format, args)
* }</pre>
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
* formatting. If <tt>l</tt> is <tt>null</tt> then no localization
* formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@ -898,7 +902,7 @@ public class PrintStream extends FilterOutputStream
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -911,7 +915,7 @@ public class PrintStream extends FilterOutputStream
* formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This output stream
*
@ -941,7 +945,7 @@ public class PrintStream extends FilterOutputStream
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -954,7 +958,7 @@ public class PrintStream extends FilterOutputStream
* formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This output stream
*
@ -983,7 +987,7 @@ public class PrintStream extends FilterOutputStream
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
* formatting. If <tt>l</tt> is <tt>null</tt> then no localization
* formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@ -998,7 +1002,7 @@ public class PrintStream extends FilterOutputStream
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -1011,7 +1015,7 @@ public class PrintStream extends FilterOutputStream
* formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This output stream
*
@ -1037,21 +1041,22 @@ public class PrintStream extends FilterOutputStream
/**
* Appends the specified character sequence to this output stream.
*
* <p> An invocation of this method of the form <tt>out.append(csq)</tt>
* <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.print(csq.toString()) </pre>
* <pre>{@code
* out.print(csq.toString())
* }</pre>
*
* <p> Depending on the specification of <tt>toString</tt> for the
* character sequence <tt>csq</tt>, the entire sequence may not be
* appended. For instance, invoking then <tt>toString</tt> method of a
* <p> Depending on the specification of {@code toString} for the
* character sequence {@code csq}, the entire sequence may not be
* appended. For instance, invoking then {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
* The character sequence to append. If <tt>csq</tt> is
* <tt>null</tt>, then the four characters <tt>"null"</tt> are
* The character sequence to append. If {@code csq} is
* {@code null}, then the four characters {@code "null"} are
* appended to this output stream.
*
* @return This output stream
@ -1070,18 +1075,20 @@ public class PrintStream extends FilterOutputStream
* Appends a subsequence of the specified character sequence to this output
* stream.
*
* <p> An invocation of this method of the form <tt>out.append(csq, start,
* end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
* <p> An invocation of this method of the form
* {@code out.append(csq, start, end)} when
* {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
* <pre>
* out.print(csq.subSequence(start, end).toString()) </pre>
* <pre>{@code
* out.print(csq.subSequence(start, end).toString())
* }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
* appended. If <tt>csq</tt> is <tt>null</tt>, then characters
* will be appended as if <tt>csq</tt> contained the four
* characters <tt>"null"</tt>.
* appended. If {@code csq} is {@code null}, then characters
* will be appended as if {@code csq} contained the four
* characters {@code "null"}.
*
* @param start
* The index of the first character in the subsequence
@ -1093,9 +1100,9 @@ public class PrintStream extends FilterOutputStream
* @return This output stream
*
* @throws IndexOutOfBoundsException
* If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
* is greater than <tt>end</tt>, or <tt>end</tt> is greater than
* <tt>csq.length()</tt>
* If {@code start} or {@code end} are negative, {@code start}
* is greater than {@code end}, or {@code end} is greater than
* {@code csq.length()}
*
* @since 1.5
*/
@ -1108,11 +1115,12 @@ public class PrintStream extends FilterOutputStream
/**
* Appends the specified character to this output stream.
*
* <p> An invocation of this method of the form <tt>out.append(c)</tt>
* <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.print(c) </pre>
* <pre>{@code
* out.print(c)
* }</pre>
*
* @param c
* The 16-bit character to append

View File

@ -34,13 +34,13 @@ import java.nio.charset.UnsupportedCharsetException;
/**
* Prints formatted representations of objects to a text-output stream. This
* class implements all of the <tt>print</tt> methods found in {@link
* class implements all of the {@code print} methods found in {@link
* PrintStream}. It does not contain methods for writing raw bytes, for which
* a program should use unencoded byte streams.
*
* <p> Unlike the {@link PrintStream} class, if automatic flushing is enabled
* it will be done only when one of the <tt>println</tt>, <tt>printf</tt>, or
* <tt>format</tt> methods is invoked, rather than whenever a newline character
* it will be done only when one of the {@code println}, {@code printf}, or
* {@code format} methods is invoked, rather than whenever a newline character
* happens to be output. These methods use the platform's own notion of line
* separator rather than the newline character.
*
@ -57,7 +57,7 @@ public class PrintWriter extends Writer {
/**
* The underlying character-output stream of this
* <code>PrintWriter</code>.
* {@code PrintWriter}.
*
* @since 1.2
*/
@ -98,8 +98,8 @@ public class PrintWriter extends Writer {
* Creates a new PrintWriter.
*
* @param out A character-output stream
* @param autoFlush A boolean; if true, the <tt>println</tt>,
* <tt>printf</tt>, or <tt>format</tt> methods will
* @param autoFlush A boolean; if true, the {@code println},
* {@code printf}, or {@code format} methods will
* flush the output buffer
*/
public PrintWriter(Writer out,
@ -130,8 +130,8 @@ public class PrintWriter extends Writer {
* default character encoding.
*
* @param out An output stream
* @param autoFlush A boolean; if true, the <tt>println</tt>,
* <tt>printf</tt>, or <tt>format</tt> methods will
* @param autoFlush A boolean; if true, the {@code println},
* {@code printf}, or {@code format} methods will
* flush the output buffer
*
* @see java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream)
@ -340,7 +340,7 @@ public class PrintWriter extends Writer {
/**
* Flushes the stream if it's not closed and checks its error state.
*
* @return <code>true</code> if the print stream has encountered an error,
* @return {@code true} if the print stream has encountered an error,
* either on the underlying output stream or during a format
* conversion.
*/
@ -361,7 +361,7 @@ public class PrintWriter extends Writer {
* Indicates that an error has occurred.
*
* <p> This method will cause subsequent invocations of {@link
* #checkError()} to return <tt>true</tt> until {@link
* #checkError()} to return {@code true} until {@link
* #clearError()} is invoked.
*/
protected void setError() {
@ -372,7 +372,7 @@ public class PrintWriter extends Writer {
* Clears the error state of this stream.
*
* <p> This method will cause subsequent invocations of {@link
* #checkError()} to return <tt>false</tt> until another write
* #checkError()} to return {@code false} until another write
* operation fails and invokes {@link #setError()}.
*
* @since 1.6
@ -485,13 +485,13 @@ public class PrintWriter extends Writer {
/* Methods that do not terminate lines */
/**
* Prints a boolean value. The string produced by <code>{@link
* java.lang.String#valueOf(boolean)}</code> is translated into bytes
* Prints a boolean value. The string produced by {@link
* java.lang.String#valueOf(boolean)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link
* #write(int)}</code> method.
* are written in exactly the manner of the {@link
* #write(int)} method.
*
* @param b The <code>boolean</code> to be printed
* @param b The {@code boolean} to be printed
*/
public void print(boolean b) {
write(b ? "true" : "false");
@ -500,23 +500,23 @@ public class PrintWriter extends Writer {
/**
* Prints a character. The character is translated into one or more bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link
* #write(int)}</code> method.
* are written in exactly the manner of the {@link
* #write(int)} method.
*
* @param c The <code>char</code> to be printed
* @param c The {@code char} to be printed
*/
public void print(char c) {
write(c);
}
/**
* Prints an integer. The string produced by <code>{@link
* java.lang.String#valueOf(int)}</code> is translated into bytes according
* Prints an integer. The string produced by {@link
* java.lang.String#valueOf(int)} is translated into bytes according
* to the platform's default character encoding, and these bytes are
* written in exactly the manner of the <code>{@link #write(int)}</code>
* written in exactly the manner of the {@link #write(int)}
* method.
*
* @param i The <code>int</code> to be printed
* @param i The {@code int} to be printed
* @see java.lang.Integer#toString(int)
*/
public void print(int i) {
@ -524,13 +524,13 @@ public class PrintWriter extends Writer {
}
/**
* Prints a long integer. The string produced by <code>{@link
* java.lang.String#valueOf(long)}</code> is translated into bytes
* Prints a long integer. The string produced by {@link
* java.lang.String#valueOf(long)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link #write(int)}</code>
* are written in exactly the manner of the {@link #write(int)}
* method.
*
* @param l The <code>long</code> to be printed
* @param l The {@code long} to be printed
* @see java.lang.Long#toString(long)
*/
public void print(long l) {
@ -538,13 +538,13 @@ public class PrintWriter extends Writer {
}
/**
* Prints a floating-point number. The string produced by <code>{@link
* java.lang.String#valueOf(float)}</code> is translated into bytes
* Prints a floating-point number. The string produced by {@link
* java.lang.String#valueOf(float)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link #write(int)}</code>
* are written in exactly the manner of the {@link #write(int)}
* method.
*
* @param f The <code>float</code> to be printed
* @param f The {@code float} to be printed
* @see java.lang.Float#toString(float)
*/
public void print(float f) {
@ -553,12 +553,12 @@ public class PrintWriter extends Writer {
/**
* Prints a double-precision floating-point number. The string produced by
* <code>{@link java.lang.String#valueOf(double)}</code> is translated into
* {@link java.lang.String#valueOf(double)} is translated into
* bytes according to the platform's default character encoding, and these
* bytes are written in exactly the manner of the <code>{@link
* #write(int)}</code> method.
* bytes are written in exactly the manner of the {@link
* #write(int)} method.
*
* @param d The <code>double</code> to be printed
* @param d The {@code double} to be printed
* @see java.lang.Double#toString(double)
*/
public void print(double d) {
@ -568,25 +568,25 @@ public class PrintWriter extends Writer {
/**
* Prints an array of characters. The characters are converted into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link #write(int)}</code>
* are written in exactly the manner of the {@link #write(int)}
* method.
*
* @param s The array of chars to be printed
*
* @throws NullPointerException If <code>s</code> is <code>null</code>
* @throws NullPointerException If {@code s} is {@code null}
*/
public void print(char s[]) {
write(s);
}
/**
* Prints a string. If the argument is <code>null</code> then the string
* <code>"null"</code> is printed. Otherwise, the string's characters are
* Prints a string. If the argument is {@code null} then the string
* {@code "null"} is printed. Otherwise, the string's characters are
* converted into bytes according to the platform's default character
* encoding, and these bytes are written in exactly the manner of the
* <code>{@link #write(int)}</code> method.
* {@link #write(int)} method.
*
* @param s The <code>String</code> to be printed
* @param s The {@code String} to be printed
*/
public void print(String s) {
if (s == null) {
@ -596,13 +596,13 @@ public class PrintWriter extends Writer {
}
/**
* Prints an object. The string produced by the <code>{@link
* java.lang.String#valueOf(Object)}</code> method is translated into bytes
* Prints an object. The string produced by the {@link
* java.lang.String#valueOf(Object)} method is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the <code>{@link #write(int)}</code>
* are written in exactly the manner of the {@link #write(int)}
* method.
*
* @param obj The <code>Object</code> to be printed
* @param obj The {@code Object} to be printed
* @see java.lang.Object#toString()
*/
public void print(Object obj) {
@ -614,8 +614,8 @@ public class PrintWriter extends Writer {
/**
* Terminates the current line by writing the line separator string. The
* line separator string is defined by the system property
* <code>line.separator</code>, and is not necessarily a single newline
* character (<code>'\n'</code>).
* {@code line.separator}, and is not necessarily a single newline
* character ({@code '\n'}).
*/
public void println() {
newLine();
@ -623,10 +623,10 @@ public class PrintWriter extends Writer {
/**
* Prints a boolean value and then terminates the line. This method behaves
* as though it invokes <code>{@link #print(boolean)}</code> and then
* <code>{@link #println()}</code>.
* as though it invokes {@link #print(boolean)} and then
* {@link #println()}.
*
* @param x the <code>boolean</code> value to be printed
* @param x the {@code boolean} value to be printed
*/
public void println(boolean x) {
synchronized (lock) {
@ -637,10 +637,10 @@ public class PrintWriter extends Writer {
/**
* Prints a character and then terminates the line. This method behaves as
* though it invokes <code>{@link #print(char)}</code> and then <code>{@link
* #println()}</code>.
* though it invokes {@link #print(char)} and then {@link
* #println()}.
*
* @param x the <code>char</code> value to be printed
* @param x the {@code char} value to be printed
*/
public void println(char x) {
synchronized (lock) {
@ -651,10 +651,10 @@ public class PrintWriter extends Writer {
/**
* Prints an integer and then terminates the line. This method behaves as
* though it invokes <code>{@link #print(int)}</code> and then <code>{@link
* #println()}</code>.
* though it invokes {@link #print(int)} and then {@link
* #println()}.
*
* @param x the <code>int</code> value to be printed
* @param x the {@code int} value to be printed
*/
public void println(int x) {
synchronized (lock) {
@ -665,10 +665,10 @@ public class PrintWriter extends Writer {
/**
* Prints a long integer and then terminates the line. This method behaves
* as though it invokes <code>{@link #print(long)}</code> and then
* <code>{@link #println()}</code>.
* as though it invokes {@link #print(long)} and then
* {@link #println()}.
*
* @param x the <code>long</code> value to be printed
* @param x the {@code long} value to be printed
*/
public void println(long x) {
synchronized (lock) {
@ -679,10 +679,10 @@ public class PrintWriter extends Writer {
/**
* Prints a floating-point number and then terminates the line. This method
* behaves as though it invokes <code>{@link #print(float)}</code> and then
* <code>{@link #println()}</code>.
* behaves as though it invokes {@link #print(float)} and then
* {@link #println()}.
*
* @param x the <code>float</code> value to be printed
* @param x the {@code float} value to be printed
*/
public void println(float x) {
synchronized (lock) {
@ -693,10 +693,10 @@ public class PrintWriter extends Writer {
/**
* Prints a double-precision floating-point number and then terminates the
* line. This method behaves as though it invokes <code>{@link
* #print(double)}</code> and then <code>{@link #println()}</code>.
* line. This method behaves as though it invokes {@link
* #print(double)} and then {@link #println()}.
*
* @param x the <code>double</code> value to be printed
* @param x the {@code double} value to be printed
*/
public void println(double x) {
synchronized (lock) {
@ -707,10 +707,10 @@ public class PrintWriter extends Writer {
/**
* Prints an array of characters and then terminates the line. This method
* behaves as though it invokes <code>{@link #print(char[])}</code> and then
* <code>{@link #println()}</code>.
* behaves as though it invokes {@link #print(char[])} and then
* {@link #println()}.
*
* @param x the array of <code>char</code> values to be printed
* @param x the array of {@code char} values to be printed
*/
public void println(char x[]) {
synchronized (lock) {
@ -721,10 +721,10 @@ public class PrintWriter extends Writer {
/**
* Prints a String and then terminates the line. This method behaves as
* though it invokes <code>{@link #print(String)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(String)} and then
* {@link #println()}.
*
* @param x the <code>String</code> value to be printed
* @param x the {@code String} value to be printed
*/
public void println(String x) {
synchronized (lock) {
@ -737,10 +737,10 @@ public class PrintWriter extends Writer {
* Prints an Object and then terminates the line. This method calls
* at first String.valueOf(x) to get the printed object's string value,
* then behaves as
* though it invokes <code>{@link #print(String)}</code> and then
* <code>{@link #println()}</code>.
* though it invokes {@link #print(String)} and then
* {@link #println()}.
*
* @param x The <code>Object</code> to be printed.
* @param x The {@code Object} to be printed.
*/
public void println(Object x) {
String s = String.valueOf(x);
@ -755,11 +755,13 @@ public class PrintWriter extends Writer {
* the specified format string and arguments. If automatic flushing is
* enabled, calls to this method will flush the output buffer.
*
* <p> An invocation of this method of the form <tt>out.printf(format,
* args)</tt> behaves in exactly the same way as the invocation
* <p> An invocation of this method of the form
* {@code out.printf(format, args)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.format(format, args) </pre>
* <pre>{@code
* out.format(format, args)
* }</pre>
*
* @param format
* A format string as described in <a
@ -773,7 +775,7 @@ public class PrintWriter extends Writer {
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -786,7 +788,7 @@ public class PrintWriter extends Writer {
* formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This writer
*
@ -801,15 +803,17 @@ public class PrintWriter extends Writer {
* the specified format string and arguments. If automatic flushing is
* enabled, calls to this method will flush the output buffer.
*
* <p> An invocation of this method of the form <tt>out.printf(l, format,
* args)</tt> behaves in exactly the same way as the invocation
* <p> An invocation of this method of the form
* {@code out.printf(l, format, args)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.format(l, format, args) </pre>
* <pre>{@code
* out.format(l, format, args)
* }</pre>
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
* formatting. If <tt>l</tt> is <tt>null</tt> then no localization
* formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@ -824,7 +828,7 @@ public class PrintWriter extends Writer {
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -837,7 +841,7 @@ public class PrintWriter extends Writer {
* formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This writer
*
@ -868,7 +872,7 @@ public class PrintWriter extends Writer {
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -881,7 +885,7 @@ public class PrintWriter extends Writer {
* Formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This writer
*
@ -913,7 +917,7 @@ public class PrintWriter extends Writer {
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
* formatting. If <tt>l</tt> is <tt>null</tt> then no localization
* formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@ -928,7 +932,7 @@ public class PrintWriter extends Writer {
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java&trade; Virtual Machine Specification</cite>.
* The behaviour on a
* <tt>null</tt> argument depends on the <a
* {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@ -941,7 +945,7 @@ public class PrintWriter extends Writer {
* formatter class specification.
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
* If the {@code format} is {@code null}
*
* @return This writer
*
@ -968,21 +972,22 @@ public class PrintWriter extends Writer {
/**
* Appends the specified character sequence to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(csq)</tt>
* <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(csq.toString()) </pre>
* <pre>{@code
* out.write(csq.toString())
* }</pre>
*
* <p> Depending on the specification of <tt>toString</tt> for the
* character sequence <tt>csq</tt>, the entire sequence may not be
* appended. For instance, invoking the <tt>toString</tt> method of a
* <p> Depending on the specification of {@code toString} for the
* character sequence {@code csq}, the entire sequence may not be
* appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
* The character sequence to append. If <tt>csq</tt> is
* <tt>null</tt>, then the four characters <tt>"null"</tt> are
* The character sequence to append. If {@code csq} is
* {@code null}, then the four characters {@code "null"} are
* appended to this writer.
*
* @return This writer
@ -1000,18 +1005,20 @@ public class PrintWriter extends Writer {
/**
* Appends a subsequence of the specified character sequence to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(csq, start,
* end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
* <p> An invocation of this method of the form
* {@code out.append(csq, start, end)}
* when {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
* <pre>
* out.write(csq.subSequence(start, end).toString()) </pre>
* <pre>{@code
* out.write(csq.subSequence(start, end).toString())
* }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
* appended. If <tt>csq</tt> is <tt>null</tt>, then characters
* will be appended as if <tt>csq</tt> contained the four
* characters <tt>"null"</tt>.
* appended. If {@code csq} is {@code null}, then characters
* will be appended as if {@code csq} contained the four
* characters {@code "null"}.
*
* @param start
* The index of the first character in the subsequence
@ -1023,9 +1030,9 @@ public class PrintWriter extends Writer {
* @return This writer
*
* @throws IndexOutOfBoundsException
* If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
* is greater than <tt>end</tt>, or <tt>end</tt> is greater than
* <tt>csq.length()</tt>
* If {@code start} or {@code end} are negative, {@code start}
* is greater than {@code end}, or {@code end} is greater than
* {@code csq.length()}
*
* @since 1.5
*/
@ -1038,11 +1045,12 @@ public class PrintWriter extends Writer {
/**
* Appends the specified character to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(c)</tt>
* <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(c) </pre>
* <pre>{@code
* out.write(c)
* }</pre>
*
* @param c
* The 16-bit character to append

View File

@ -82,10 +82,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* {@link FileDescriptor} object is created to represent the
* connection to the file.
*
* <p> The <tt>mode</tt> argument specifies the access mode with which the
* <p> The {@code mode} argument specifies the access mode with which the
* file is to be opened. The permitted values and their meanings are as
* specified for the <a
* href="#mode"><tt>RandomAccessFile(File,String)</tt></a> constructor.
* href="#mode">{@code RandomAccessFile(File,String)}</a> constructor.
*
* <p>
* If there is a security manager, its {@code checkRead} method
@ -99,19 +99,19 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @param name the system-dependent filename
* @param mode the access <a href="#mode">mode</a>
* @exception IllegalArgumentException if the mode argument is not equal
* to one of <tt>"r"</tt>, <tt>"rw"</tt>, <tt>"rws"</tt>, or
* <tt>"rwd"</tt>
* to one of {@code "r"}, {@code "rw"}, {@code "rws"}, or
* {@code "rwd"}
* @exception FileNotFoundException
* if the mode is <tt>"r"</tt> but the given string does not
* if the mode is {@code "r"} but the given string does not
* denote an existing regular file, or if the mode begins with
* <tt>"rw"</tt> but the given string does not denote an
* {@code "rw"} but the given string does not denote an
* existing, writable regular file and a new regular file of
* that name cannot be created, or if some other error occurs
* while opening or creating the file
* @exception SecurityException if a security manager exists and its
* {@code checkRead} method denies read access to the file
* or the mode is "rw" and the security manager's
* {@code checkWrite} method denies write access to the file
* @exception SecurityException if a security manager exists and its
* {@code checkRead} method denies read access to the file
* or the mode is {@code "rw"} and the security manager's
* {@code checkWrite} method denies write access to the file
* @see java.lang.SecurityException
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
@ -129,33 +129,33 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* write to, the file specified by the {@link File} argument. A new {@link
* FileDescriptor} object is created to represent this file connection.
*
* <p>The <a name="mode"><tt>mode</tt></a> argument specifies the access mode
* <p>The <a name="mode">{@code mode}</a> argument specifies the access mode
* in which the file is to be opened. The permitted values and their
* meanings are:
*
* <table summary="Access mode permitted values and meanings">
* <tr><th align="left">Value</th><th align="left">Meaning</th></tr>
* <tr><td valign="top"><tt>"r"</tt></td>
* <td> Open for reading only. Invoking any of the <tt>write</tt>
* methods of the resulting object will cause an {@link
* java.io.IOException} to be thrown. </td></tr>
* <tr><td valign="top"><tt>"rw"</tt></td>
* <tr><td valign="top">{@code "r"}</td>
* <td> Open for reading only. Invoking any of the {@code write}
* methods of the resulting object will cause an
* {@link java.io.IOException} to be thrown.</td></tr>
* <tr><td valign="top">{@code "rw"}</td>
* <td> Open for reading and writing. If the file does not already
* exist then an attempt will be made to create it. </td></tr>
* <tr><td valign="top"><tt>"rws"</tt></td>
* <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
* exist then an attempt will be made to create it.</td></tr>
* <tr><td valign="top">{@code "rws"}</td>
* <td> Open for reading and writing, as with {@code "rw"}, and also
* require that every update to the file's content or metadata be
* written synchronously to the underlying storage device. </td></tr>
* <tr><td valign="top"><tt>"rwd"&nbsp;&nbsp;</tt></td>
* <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
* written synchronously to the underlying storage device.</td></tr>
* <tr><td valign="top">{@code "rwd"}</td>
* <td> Open for reading and writing, as with {@code "rw"}, and also
* require that every update to the file's content be written
* synchronously to the underlying storage device. </td></tr>
* synchronously to the underlying storage device.</td></tr>
* </table>
*
* The <tt>"rws"</tt> and <tt>"rwd"</tt> modes work much like the {@link
* The {@code "rws"} and {@code "rwd"} modes work much like the {@link
* java.nio.channels.FileChannel#force(boolean) force(boolean)} method of
* the {@link java.nio.channels.FileChannel} class, passing arguments of
* <tt>true</tt> and <tt>false</tt>, respectively, except that they always
* {@code true} and {@code false}, respectively, except that they always
* apply to every I/O operation and are therefore often more efficient. If
* the file resides on a local storage device then when an invocation of a
* method of this class returns it is guaranteed that all changes made to
@ -164,9 +164,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* event of a system crash. If the file does not reside on a local device
* then no such guarantee is made.
*
* <p>The <tt>"rwd"</tt> mode can be used to reduce the number of I/O
* operations performed. Using <tt>"rwd"</tt> only requires updates to the
* file's content to be written to storage; using <tt>"rws"</tt> requires
* <p>The {@code "rwd"} mode can be used to reduce the number of I/O
* operations performed. Using {@code "rwd"} only requires updates to the
* file's content to be written to storage; using {@code "rws"} requires
* updates to both the file's content and its metadata to be written, which
* generally requires at least one more low-level I/O operation.
*
@ -181,19 +181,19 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @param mode the access mode, as described
* <a href="#mode">above</a>
* @exception IllegalArgumentException if the mode argument is not equal
* to one of <tt>"r"</tt>, <tt>"rw"</tt>, <tt>"rws"</tt>, or
* <tt>"rwd"</tt>
* to one of {@code "r"}, {@code "rw"}, {@code "rws"}, or
* {@code "rwd"}
* @exception FileNotFoundException
* if the mode is <tt>"r"</tt> but the given file object does
* if the mode is {@code "r"} but the given file object does
* not denote an existing regular file, or if the mode begins
* with <tt>"rw"</tt> but the given file object does not denote
* with {@code "rw"} but the given file object does not denote
* an existing, writable regular file and a new regular file of
* that name cannot be created, or if some other error occurs
* while opening or creating the file
* @exception SecurityException if a security manager exists and its
* {@code checkRead} method denies read access to the file
* or the mode is "rw" and the security manager's
* {@code checkWrite} method denies write access to the file
* @exception SecurityException if a security manager exists and its
* {@code checkRead} method denies read access to the file
* or the mode is {@code "rw"} and the security manager's
* {@code checkWrite} method denies write access to the file
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
* @see java.nio.channels.FileChannel#force(boolean)

View File

@ -54,7 +54,7 @@ public abstract class Reader implements Readable, Closeable {
* The object used to synchronize operations on this stream. For
* efficiency, a character-stream object may use an object other than
* itself to protect critical sections. A subclass should therefore use
* the object in this field rather than <tt>this</tt> or a synchronized
* the object in this field rather than {@code this} or a synchronized
* method.
*/
protected Object lock;
@ -111,7 +111,7 @@ public abstract class Reader implements Readable, Closeable {
* should override this method.
*
* @return The character read, as an integer in the range 0 to 65535
* (<tt>0x00-0xffff</tt>), or -1 if the end of the stream has
* ({@code 0x00-0xffff}), or -1 if the end of the stream has
* been reached
*
* @exception IOException If an I/O error occurs

View File

@ -30,9 +30,9 @@ package java.io;
* A character stream that collects its output in a string buffer, which can
* then be used to construct a string.
* <p>
* Closing a <tt>StringWriter</tt> has no effect. The methods in this class
* Closing a {@code StringWriter} has no effect. The methods in this class
* can be called after the stream has been closed without generating an
* <tt>IOException</tt>.
* {@code IOException}.
*
* @author Mark Reinhold
* @since 1.1
@ -56,11 +56,11 @@ public class StringWriter extends Writer {
* size.
*
* @param initialSize
* The number of <tt>char</tt> values that will fit into this buffer
* The number of {@code char} values that will fit into this buffer
* before it is automatically expanded
*
* @throws IllegalArgumentException
* If <tt>initialSize</tt> is negative
* If {@code initialSize} is negative
*/
public StringWriter(int initialSize) {
if (initialSize < 0) {
@ -115,21 +115,21 @@ public class StringWriter extends Writer {
/**
* Appends the specified character sequence to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(csq)</tt>
* <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(csq.toString()) </pre>
*
* <p> Depending on the specification of <tt>toString</tt> for the
* character sequence <tt>csq</tt>, the entire sequence may not be
* appended. For instance, invoking the <tt>toString</tt> method of a
* <p> Depending on the specification of {@code toString} for the
* character sequence {@code csq}, the entire sequence may not be
* appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
* The character sequence to append. If <tt>csq</tt> is
* <tt>null</tt>, then the four characters <tt>"null"</tt> are
* The character sequence to append. If {@code csq} is
* {@code null}, then the four characters "{@code null}" are
* appended to this writer.
*
* @return This writer
@ -147,18 +147,20 @@ public class StringWriter extends Writer {
/**
* Appends a subsequence of the specified character sequence to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(csq, start,
* end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
* <p> An invocation of this method of the form
* {@code out.append(csq, start, end)} when {@code csq}
* is not {@code null}, behaves in
* exactly the same way as the invocation
*
* <pre>
* out.write(csq.subSequence(start, end).toString()) </pre>
* <pre>{@code
* out.write(csq.subSequence(start, end).toString())
* }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
* appended. If <tt>csq</tt> is <tt>null</tt>, then characters
* will be appended as if <tt>csq</tt> contained the four
* characters <tt>"null"</tt>.
* appended. If {@code csq} is {@code null}, then characters
* will be appended as if {@code csq} contained the four
* characters "{@code null}".
*
* @param start
* The index of the first character in the subsequence
@ -170,9 +172,9 @@ public class StringWriter extends Writer {
* @return This writer
*
* @throws IndexOutOfBoundsException
* If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
* is greater than <tt>end</tt>, or <tt>end</tt> is greater than
* <tt>csq.length()</tt>
* If {@code start} or {@code end} are negative, {@code start}
* is greater than {@code end}, or {@code end} is greater than
* {@code csq.length()}
*
* @since 1.5
*/
@ -185,7 +187,7 @@ public class StringWriter extends Writer {
/**
* Appends the specified character to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(c)</tt>
* <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>
@ -226,9 +228,9 @@ public class StringWriter extends Writer {
}
/**
* Closing a <tt>StringWriter</tt> has no effect. The methods in this
* Closing a {@code StringWriter} has no effect. The methods in this
* class can be called after the stream has been closed without generating
* an <tt>IOException</tt>.
* an {@code IOException}.
*/
public void close() throws IOException {
}

View File

@ -63,7 +63,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* The object used to synchronize operations on this stream. For
* efficiency, a character-stream object may use an object other than
* itself to protect critical sections. A subclass should therefore use
* the object in this field rather than <tt>this</tt> or a synchronized
* the object in this field rather than {@code this} or a synchronized
* method.
*/
protected Object lock;
@ -170,8 +170,8 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* Number of characters to write
*
* @throws IndexOutOfBoundsException
* If <tt>off</tt> is negative, or <tt>len</tt> is negative,
* or <tt>off+len</tt> is negative or greater than the length
* If {@code off} is negative, or {@code len} is negative,
* or {@code off+len} is negative or greater than the length
* of the given string
*
* @throws IOException
@ -196,21 +196,21 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
/**
* Appends the specified character sequence to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(csq)</tt>
* <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(csq.toString()) </pre>
*
* <p> Depending on the specification of <tt>toString</tt> for the
* character sequence <tt>csq</tt>, the entire sequence may not be
* appended. For instance, invoking the <tt>toString</tt> method of a
* <p> Depending on the specification of {@code toString} for the
* character sequence {@code csq}, the entire sequence may not be
* appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
* The character sequence to append. If <tt>csq</tt> is
* <tt>null</tt>, then the four characters <tt>"null"</tt> are
* The character sequence to append. If {@code csq} is
* {@code null}, then the four characters "{@code null}" are
* appended to this writer.
*
* @return This writer
@ -230,20 +230,22 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
/**
* Appends a subsequence of the specified character sequence to this writer.
* <tt>Appendable</tt>.
* {@code Appendable}.
*
* <p> An invocation of this method of the form <tt>out.append(csq, start,
* end)</tt> when <tt>csq</tt> is not <tt>null</tt> behaves in exactly the
* <p> An invocation of this method of the form
* {@code out.append(csq, start, end)} when {@code csq}
* is not {@code null} behaves in exactly the
* same way as the invocation
*
* <pre>
* out.write(csq.subSequence(start, end).toString()) </pre>
* <pre>{@code
* out.write(csq.subSequence(start, end).toString())
* }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
* appended. If <tt>csq</tt> is <tt>null</tt>, then characters
* will be appended as if <tt>csq</tt> contained the four
* characters <tt>"null"</tt>.
* appended. If {@code csq} is {@code null}, then characters
* will be appended as if {@code csq} contained the four
* characters "{@code null}".
*
* @param start
* The index of the first character in the subsequence
@ -255,9 +257,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* @return This writer
*
* @throws IndexOutOfBoundsException
* If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
* is greater than <tt>end</tt>, or <tt>end</tt> is greater than
* <tt>csq.length()</tt>
* If {@code start} or {@code end} are negative, {@code start}
* is greater than {@code end}, or {@code end} is greater than
* {@code csq.length()}
*
* @throws IOException
* If an I/O error occurs
@ -273,7 +275,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
/**
* Appends the specified character to this writer.
*
* <p> An invocation of this method of the form <tt>out.append(c)</tt>
* <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>

View File

@ -28,15 +28,15 @@ package java.lang;
import java.io.IOException;
/**
* An object to which <tt>char</tt> sequences and values can be appended. The
* <tt>Appendable</tt> interface must be implemented by any class whose
* An object to which {@code char} sequences and values can be appended. The
* {@code Appendable} interface must be implemented by any class whose
* instances are intended to receive formatted output from a {@link
* java.util.Formatter}.
*
* <p> The characters to be appended should be valid Unicode characters as
* described in <a href="Character.html#unicode">Unicode Character
* Representation</a>. Note that supplementary characters may be composed of
* multiple 16-bit <tt>char</tt> values.
* multiple 16-bit {@code char} values.
*
* <p> Appendables are not necessarily safe for multithreaded access. Thread
* safety is the responsibility of classes that extend and implement this
@ -51,19 +51,19 @@ import java.io.IOException;
public interface Appendable {
/**
* Appends the specified character sequence to this <tt>Appendable</tt>.
* Appends the specified character sequence to this {@code Appendable}.
*
* <p> Depending on which class implements the character sequence
* <tt>csq</tt>, the entire sequence may not be appended. For
* instance, if <tt>csq</tt> is a {@link java.nio.CharBuffer} then
* {@code csq}, the entire sequence may not be appended. For
* instance, if {@code csq} is a {@link java.nio.CharBuffer} then
* the subsequence to append is defined by the buffer's position and limit.
*
* @param csq
* The character sequence to append. If <tt>csq</tt> is
* <tt>null</tt>, then the four characters <tt>"null"</tt> are
* The character sequence to append. If {@code csq} is
* {@code null}, then the four characters {@code "null"} are
* appended to this Appendable.
*
* @return A reference to this <tt>Appendable</tt>
* @return A reference to this {@code Appendable}
*
* @throws IOException
* If an I/O error occurs
@ -72,10 +72,10 @@ public interface Appendable {
/**
* Appends a subsequence of the specified character sequence to this
* <tt>Appendable</tt>.
* {@code Appendable}.
*
* <p> An invocation of this method of the form <tt>out.append(csq, start,
* end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
* <p> An invocation of this method of the form {@code out.append(csq, start, end)}
* when {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
* <pre>
@ -83,9 +83,9 @@ public interface Appendable {
*
* @param csq
* The character sequence from which a subsequence will be
* appended. If <tt>csq</tt> is <tt>null</tt>, then characters
* will be appended as if <tt>csq</tt> contained the four
* characters <tt>"null"</tt>.
* appended. If {@code csq} is {@code null}, then characters
* will be appended as if {@code csq} contained the four
* characters {@code "null"}.
*
* @param start
* The index of the first character in the subsequence
@ -94,12 +94,12 @@ public interface Appendable {
* The index of the character following the last character in the
* subsequence
*
* @return A reference to this <tt>Appendable</tt>
* @return A reference to this {@code Appendable}
*
* @throws IndexOutOfBoundsException
* If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
* is greater than <tt>end</tt>, or <tt>end</tt> is greater than
* <tt>csq.length()</tt>
* If {@code start} or {@code end} are negative, {@code start}
* is greater than {@code end}, or {@code end} is greater than
* {@code csq.length()}
*
* @throws IOException
* If an I/O error occurs
@ -107,12 +107,12 @@ public interface Appendable {
Appendable append(CharSequence csq, int start, int end) throws IOException;
/**
* Appends the specified character to this <tt>Appendable</tt>.
* Appends the specified character to this {@code Appendable}.
*
* @param c
* The character to append
*
* @return A reference to this <tt>Appendable</tt>
* @return A reference to this {@code Appendable}
*
* @throws IOException
* If an I/O error occurs

View File

@ -28,7 +28,7 @@ import java.util.*;
/*
* Class to track and run user level shutdown hooks registered through
* <tt>{@link Runtime#addShutdownHook Runtime.addShutdownHook}</tt>.
* {@link Runtime#addShutdownHook Runtime.addShutdownHook}.
*
* @see java.lang.Runtime#addShutdownHook
* @see java.lang.Runtime#removeShutdownHook

View File

@ -29,8 +29,8 @@ package java.lang;
* A collection of assertion status directives (such as "enable assertions
* in package p" or "disable assertions in class c"). This class is used by
* the JVM to communicate the assertion status directives implied by
* the <tt>java</tt> command line flags <tt>-enableassertions</tt>
* (<tt>-ea</tt>) and <tt>-disableassertions</tt> (<tt>-da</tt>).
* the {@code java} command line flags {@code -enableassertions}
* ({@code -ea}) and {@code -disableassertions} ({@code -da}).
*
* @since 1.4
* @author Josh Bloch
@ -44,19 +44,19 @@ class AssertionStatusDirectives {
String[] classes;
/**
* A parallel array to <tt>classes</tt>, indicating whether each class
* is to have assertions enabled or disabled. A value of <tt>true</tt>
* for <tt>classEnabled[i]</tt> indicates that the class named by
* <tt>classes[i]</tt> should have assertions enabled; a value of
* <tt>false</tt> indicates that it should have classes disabled.
* This array must have the same number of elements as <tt>classes</tt>.
* A parallel array to {@code classes}, indicating whether each class
* is to have assertions enabled or disabled. A value of {@code true}
* for {@code classEnabled[i]} indicates that the class named by
* {@code classes[i]} should have assertions enabled; a value of
* {@code false} indicates that it should have classes disabled.
* This array must have the same number of elements as {@code classes}.
*
* <p>In the case of conflicting directives for the same class, the
* last directive for a given class wins. In other words, if a string
* <tt>s</tt> appears multiple times in the <tt>classes</tt> array
* and <tt>i</tt> is the highest integer for which
* <tt>classes[i].equals(s)</tt>, then <tt>classEnabled[i]</tt>
* indicates whether assertions are to be enabled in class <tt>s</tt>.
* {@code s} appears multiple times in the {@code classes} array
* and {@code i} is the highest integer for which
* {@code classes[i].equals(s)}, then {@code classEnabled[i]}
* indicates whether assertions are to be enabled in class {@code s}.
*/
boolean[] classEnabled;
@ -68,21 +68,21 @@ class AssertionStatusDirectives {
String[] packages;
/**
* A parallel array to <tt>packages</tt>, indicating whether each
* A parallel array to {@code packages}, indicating whether each
* package-tree is to have assertions enabled or disabled. A value of
* <tt>true</tt> for <tt>packageEnabled[i]</tt> indicates that the
* package-tree named by <tt>packages[i]</tt> should have assertions
* enabled; a value of <tt>false</tt> indicates that it should have
* {@code true} for {@code packageEnabled[i]} indicates that the
* package-tree named by {@code packages[i]} should have assertions
* enabled; a value of {@code false} indicates that it should have
* assertions disabled. This array must have the same number of
* elements as <tt>packages</tt>.
* elements as {@code packages}.
*
* In the case of conflicting directives for the same package-tree, the
* last directive for a given package-tree wins. In other words, if a
* string <tt>s</tt> appears multiple times in the <tt>packages</tt> array
* and <tt>i</tt> is the highest integer for which
* <tt>packages[i].equals(s)</tt>, then <tt>packageEnabled[i]</tt>
* string {@code s} appears multiple times in the {@code packages} array
* and {@code i} is the highest integer for which
* {@code packages[i].equals(s)}, then {@code packageEnabled[i]}
* indicates whether assertions are to be enabled in package-tree
* <tt>s</tt>.
* {@code s}.
*/
boolean[] packageEnabled;

View File

@ -34,21 +34,21 @@ import java.util.stream.IntStream;
import java.util.stream.StreamSupport;
/**
* A <tt>CharSequence</tt> is a readable sequence of <code>char</code> values. This
* A {@code CharSequence} is a readable sequence of {@code char} values. This
* interface provides uniform, read-only access to many different kinds of
* <code>char</code> sequences.
* A <code>char</code> value represents a character in the <i>Basic
* {@code char} sequences.
* A {@code char} value represents a character in the <i>Basic
* Multilingual Plane (BMP)</i> or a surrogate. Refer to <a
* href="Character.html#unicode">Unicode Character Representation</a> for details.
*
* <p> This interface does not refine the general contracts of the {@link
* java.lang.Object#equals(java.lang.Object) equals} and {@link
* java.lang.Object#hashCode() hashCode} methods. The result of comparing two
* objects that implement <tt>CharSequence</tt> is therefore, in general,
* objects that implement {@code CharSequence} is therefore, in general,
* undefined. Each object may be implemented by a different class, and there
* is no guarantee that each class will be capable of testing its instances
* for equality with those of the other. It is therefore inappropriate to use
* arbitrary <tt>CharSequence</tt> instances as elements in a set or as keys in
* arbitrary {@code CharSequence} instances as elements in a set or as keys in
* a map. </p>
*
* @author Mike McCloskey
@ -60,38 +60,38 @@ public interface CharSequence {
/**
* Returns the length of this character sequence. The length is the number
* of 16-bit <code>char</code>s in the sequence.
* of 16-bit {@code char}s in the sequence.
*
* @return the number of <code>char</code>s in this sequence
* @return the number of {@code char}s in this sequence
*/
int length();
/**
* Returns the <code>char</code> value at the specified index. An index ranges from zero
* to <tt>length() - 1</tt>. The first <code>char</code> value of the sequence is at
* Returns the {@code char} value at the specified index. An index ranges from zero
* to {@code length() - 1}. The first {@code char} value of the sequence is at
* index zero, the next at index one, and so on, as for array
* indexing.
*
* <p>If the <code>char</code> value specified by the index is a
* <p>If the {@code char} value specified by the index is a
* <a href="{@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate
* value is returned.
*
* @param index the index of the <code>char</code> value to be returned
* @param index the index of the {@code char} value to be returned
*
* @return the specified <code>char</code> value
* @return the specified {@code char} value
*
* @throws IndexOutOfBoundsException
* if the <tt>index</tt> argument is negative or not less than
* <tt>length()</tt>
* if the {@code index} argument is negative or not less than
* {@code length()}
*/
char charAt(int index);
/**
* Returns a <code>CharSequence</code> that is a subsequence of this sequence.
* The subsequence starts with the <code>char</code> value at the specified index and
* ends with the <code>char</code> value at index <tt>end - 1</tt>. The length
* (in <code>char</code>s) of the
* returned sequence is <tt>end - start</tt>, so if <tt>start == end</tt>
* Returns a {@code CharSequence} that is a subsequence of this sequence.
* The subsequence starts with the {@code char} value at the specified index and
* ends with the {@code char} value at index {@code end - 1}. The length
* (in {@code char}s) of the
* returned sequence is {@code end - start}, so if {@code start == end}
* then an empty sequence is returned.
*
* @param start the start index, inclusive
@ -100,9 +100,9 @@ public interface CharSequence {
* @return the specified subsequence
*
* @throws IndexOutOfBoundsException
* if <tt>start</tt> or <tt>end</tt> are negative,
* if <tt>end</tt> is greater than <tt>length()</tt>,
* or if <tt>start</tt> is greater than <tt>end</tt>
* if {@code start} or {@code end} are negative,
* if {@code end} is greater than {@code length()},
* or if {@code start} is greater than {@code end}
*/
CharSequence subSequence(int start, int end);

View File

@ -3502,7 +3502,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
/**
* Returns the UnicodeBlock with the given name. Block
* names are determined by The Unicode Standard. The file
* Blocks-&lt;version&gt;.txt defines blocks for a particular
* {@code Blocks-<version>.txt} defines blocks for a particular
* version of the standard. The {@link Character} class specifies
* the version of the standard that it supports.
* <p>
@ -7195,8 +7195,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
/**
* Returns the UnicodeScript constant with the given Unicode script
* name or the script name alias. Script names and their aliases are
* determined by The Unicode Standard. The files Scripts&lt;version&gt;.txt
* and PropertyValueAliases&lt;version&gt;.txt define script names
* determined by The Unicode Standard. The files {@code Scripts<version>.txt}
* and {@code PropertyValueAliases<version>.txt} define script names
* and the script name aliases for a particular version of the
* standard. The {@link Character} class specifies the version of
* the standard that it supports.
@ -7255,9 +7255,9 @@ class Character implements java.io.Serializable, Comparable<Character> {
}
/**
* Returns a <tt>Character</tt> instance representing the specified
* <tt>char</tt> value.
* If a new <tt>Character</tt> instance is not required, this method
* Returns a {@code Character} instance representing the specified
* {@code char} value.
* If a new {@code Character} instance is not required, this method
* should generally be used in preference to the constructor
* {@link #Character(char)}, as this method is likely to yield
* significantly better space and time performance by caching
@ -7268,7 +7268,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* cache other values outside of this range.
*
* @param c a char value.
* @return a <tt>Character</tt> instance representing <tt>c</tt>.
* @return a {@code Character} instance representing {@code c}.
* @since 1.5
*/
@HotSpotIntrinsicCandidate
@ -9871,7 +9871,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
}
/**
* The number of bits used to represent a <tt>char</tt> value in unsigned
* The number of bits used to represent a {@code char} value in unsigned
* binary form, constant {@code 16}.
*
* @since 1.5
@ -9888,11 +9888,11 @@ class Character implements java.io.Serializable, Comparable<Character> {
/**
* Returns the value obtained by reversing the order of the bytes in the
* specified <tt>char</tt> value.
* specified {@code char} value.
*
* @param ch The {@code char} of which to reverse the byte order.
* @return the value obtained by reversing (or, equivalently, swapping)
* the bytes in the specified <tt>char</tt> value.
* the bytes in the specified {@code char} value.
* @since 1.5
*/
@HotSpotIntrinsicCandidate

View File

@ -98,7 +98,7 @@ public class ClassNotFoundException extends ReflectiveOperationException {
/**
* Returns the exception that was raised if an error occurred while
* attempting to load the class. Otherwise, returns <tt>null</tt>.
* attempting to load the class. Otherwise, returns {@code null}.
*
* <p>This method predates the general-purpose exception chaining facility.
* The {@link Throwable#getCause()} method is now the preferred means of
@ -114,7 +114,7 @@ public class ClassNotFoundException extends ReflectiveOperationException {
/**
* Returns the cause of this exception (the exception that was raised
* if an error occurred while attempting to load the class; otherwise
* <tt>null</tt>).
* {@code null}).
*
* @return the cause of this exception.
* @since 1.4

View File

@ -36,11 +36,11 @@ package java.lang;
* <code>CloneNotSupportedException</code> being thrown.
* <p>
* By convention, classes that implement this interface should override
* <tt>Object.clone</tt> (which is protected) with a public method.
* {@code Object.clone} (which is protected) with a public method.
* See {@link java.lang.Object#clone()} for details on overriding this
* method.
* <p>
* Note that this interface does <i>not</i> contain the <tt>clone</tt> method.
* Note that this interface does <i>not</i> contain the {@code clone} method.
* Therefore, it is not possible to clone an object merely by virtue of the
* fact that it implements this interface. Even if the clone method is invoked
* reflectively, there is no guarantee that it will succeed.

View File

@ -29,7 +29,7 @@ import java.util.*;
/**
* This interface imposes a total ordering on the objects of each class that
* implements it. This ordering is referred to as the class's <i>natural
* ordering</i>, and the class's <tt>compareTo</tt> method is referred to as
* ordering</i>, and the class's {@code compareTo} method is referred to as
* its <i>natural comparison method</i>.<p>
*
* Lists (and arrays) of objects that implement this interface can be sorted
@ -39,45 +39,45 @@ import java.util.*;
* elements in a {@linkplain SortedSet sorted set}, without the need to
* specify a {@linkplain Comparator comparator}.<p>
*
* The natural ordering for a class <tt>C</tt> is said to be <i>consistent
* with equals</i> if and only if <tt>e1.compareTo(e2) == 0</tt> has
* the same boolean value as <tt>e1.equals(e2)</tt> for every
* <tt>e1</tt> and <tt>e2</tt> of class <tt>C</tt>. Note that <tt>null</tt>
* is not an instance of any class, and <tt>e.compareTo(null)</tt> should
* throw a <tt>NullPointerException</tt> even though <tt>e.equals(null)</tt>
* returns <tt>false</tt>.<p>
* The natural ordering for a class {@code C} is said to be <i>consistent
* with equals</i> if and only if {@code e1.compareTo(e2) == 0} has
* the same boolean value as {@code e1.equals(e2)} for every
* {@code e1} and {@code e2} of class {@code C}. Note that {@code null}
* is not an instance of any class, and {@code e.compareTo(null)} should
* throw a {@code NullPointerException} even though {@code e.equals(null)}
* returns {@code false}.<p>
*
* It is strongly recommended (though not required) that natural orderings be
* consistent with equals. This is so because sorted sets (and sorted maps)
* without explicit comparators behave "strangely" when they are used with
* elements (or keys) whose natural ordering is inconsistent with equals. In
* particular, such a sorted set (or sorted map) violates the general contract
* for set (or map), which is defined in terms of the <tt>equals</tt>
* for set (or map), which is defined in terms of the {@code equals}
* method.<p>
*
* For example, if one adds two keys <tt>a</tt> and <tt>b</tt> such that
* For example, if one adds two keys {@code a} and {@code b} such that
* {@code (!a.equals(b) && a.compareTo(b) == 0)} to a sorted
* set that does not use an explicit comparator, the second <tt>add</tt>
* set that does not use an explicit comparator, the second {@code add}
* operation returns false (and the size of the sorted set does not increase)
* because <tt>a</tt> and <tt>b</tt> are equivalent from the sorted set's
* because {@code a} and {@code b} are equivalent from the sorted set's
* perspective.<p>
*
* Virtually all Java core classes that implement <tt>Comparable</tt> have natural
* Virtually all Java core classes that implement {@code Comparable} have natural
* orderings that are consistent with equals. One exception is
* <tt>java.math.BigDecimal</tt>, whose natural ordering equates
* <tt>BigDecimal</tt> objects with equal values and different precisions
* {@code java.math.BigDecimal}, whose natural ordering equates
* {@code BigDecimal} objects with equal values and different precisions
* (such as 4.0 and 4.00).<p>
*
* For the mathematically inclined, the <i>relation</i> that defines
* the natural ordering on a given class C is:<pre>
* {(x, y) such that x.compareTo(y) &lt;= 0}.
* </pre> The <i>quotient</i> for this total order is: <pre>
* the natural ordering on a given class C is:<pre>{@code
* {(x, y) such that x.compareTo(y) <= 0}.
* }</pre> The <i>quotient</i> for this total order is: <pre>{@code
* {(x, y) such that x.compareTo(y) == 0}.
* </pre>
* }</pre>
*
* It follows immediately from the contract for <tt>compareTo</tt> that the
* quotient is an <i>equivalence relation</i> on <tt>C</tt>, and that the
* natural ordering is a <i>total order</i> on <tt>C</tt>. When we say that a
* It follows immediately from the contract for {@code compareTo} that the
* quotient is an <i>equivalence relation</i> on {@code C}, and that the
* natural ordering is a <i>total order</i> on {@code C}. When we say that a
* class's natural ordering is <i>consistent with equals</i>, we mean that the
* quotient for the natural ordering is the equivalence relation defined by
* the class's {@link Object#equals(Object) equals(Object)} method:<pre>
@ -99,30 +99,31 @@ public interface Comparable<T> {
* negative integer, zero, or a positive integer as this object is less
* than, equal to, or greater than the specified object.
*
* <p>The implementor must ensure <tt>sgn(x.compareTo(y)) ==
* -sgn(y.compareTo(x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This
* implies that <tt>x.compareTo(y)</tt> must throw an exception iff
* <tt>y.compareTo(x)</tt> throws an exception.)
* <p>The implementor must ensure
* {@code sgn(x.compareTo(y)) == -sgn(y.compareTo(x))}
* for all {@code x} and {@code y}. (This
* implies that {@code x.compareTo(y)} must throw an exception iff
* {@code y.compareTo(x)} throws an exception.)
*
* <p>The implementor must also ensure that the relation is transitive:
* <tt>(x.compareTo(y)&gt;0 &amp;&amp; y.compareTo(z)&gt;0)</tt> implies
* <tt>x.compareTo(z)&gt;0</tt>.
* {@code (x.compareTo(y) > 0 && y.compareTo(z) > 0)} implies
* {@code x.compareTo(z) > 0}.
*
* <p>Finally, the implementor must ensure that <tt>x.compareTo(y)==0</tt>
* implies that <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for
* all <tt>z</tt>.
* <p>Finally, the implementor must ensure that {@code x.compareTo(y)==0}
* implies that {@code sgn(x.compareTo(z)) == sgn(y.compareTo(z))}, for
* all {@code z}.
*
* <p>It is strongly recommended, but <i>not</i> strictly required that
* <tt>(x.compareTo(y)==0) == (x.equals(y))</tt>. Generally speaking, any
* class that implements the <tt>Comparable</tt> interface and violates
* {@code (x.compareTo(y)==0) == (x.equals(y))}. Generally speaking, any
* class that implements the {@code Comparable} interface and violates
* this condition should clearly indicate this fact. The recommended
* language is "Note: this class has a natural ordering that is
* inconsistent with equals."
*
* <p>In the foregoing description, the notation
* <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical
* <i>signum</i> function, which is defined to return one of <tt>-1</tt>,
* <tt>0</tt>, or <tt>1</tt> according to whether the value of
* {@code sgn(}<i>expression</i>{@code )} designates the mathematical
* <i>signum</i> function, which is defined to return one of {@code -1},
* {@code 0}, or {@code 1} according to whether the value of
* <i>expression</i> is negative, zero or positive.
*
* @param o the object to be compared.

View File

@ -51,7 +51,7 @@ public class EnumConstantNotPresentException extends RuntimeException {
private String constantName;
/**
* Constructs an <tt>EnumConstantNotPresentException</tt> for the
* Constructs an {@code EnumConstantNotPresentException} for the
* specified constant.
*
* @param enumType the type of the missing enum constant

View File

@ -75,7 +75,7 @@ public class Exception extends Throwable {
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
@ -86,14 +86,14 @@ public class Exception extends Throwable {
/**
* Constructs a new exception with the specified cause and a detail
* message of <tt>(cause==null ? null : cause.toString())</tt> (which
* typically contains the class and detail message of <tt>cause</tt>).
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4

View File

@ -63,7 +63,7 @@ class IllegalArgumentException extends RuntimeException {
* @param message the detail message (which is saved for later retrieval
* by the {@link Throwable#getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link Throwable#getCause()} method). (A <tt>null</tt> value
* {@link Throwable#getCause()} method). (A {@code null} value
* is permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
@ -74,14 +74,14 @@ class IllegalArgumentException extends RuntimeException {
/**
* Constructs a new exception with the specified cause and a detail
* message of <tt>(cause==null ? null : cause.toString())</tt> (which
* typically contains the class and detail message of <tt>cause</tt>).
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link Throwable#getCause()} method). (A <tt>null</tt> value is
* {@link Throwable#getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5

View File

@ -66,7 +66,7 @@ class IllegalStateException extends RuntimeException {
* @param message the detail message (which is saved for later retrieval
* by the {@link Throwable#getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link Throwable#getCause()} method). (A <tt>null</tt> value
* {@link Throwable#getCause()} method). (A {@code null} value
* is permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
@ -77,14 +77,14 @@ class IllegalStateException extends RuntimeException {
/**
* Constructs a new exception with the specified cause and a detail
* message of <tt>(cause==null ? null : cause.toString())</tt> (which
* typically contains the class and detail message of <tt>cause</tt>).
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link Throwable#getCause()} method). (A <tt>null</tt> value is
* {@link Throwable#getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5

View File

@ -27,12 +27,12 @@ package java.lang;
import java.lang.ref.*;
/**
* This class extends <tt>ThreadLocal</tt> to provide inheritance of values
* This class extends {@code ThreadLocal} to provide inheritance of values
* from parent thread to child thread: when a child thread is created, the
* child receives initial values for all inheritable thread-local variables
* for which the parent has values. Normally the child's values will be
* identical to the parent's; however, the child's value can be made an
* arbitrary function of the parent's by overriding the <tt>childValue</tt>
* arbitrary function of the parent's by overriding the {@code childValue}
* method in this class.
*
* <p>Inheritable thread-local variables are used in preference to

View File

@ -28,8 +28,8 @@ package java.lang;
import java.io.IOException;
/**
* A <tt>Readable</tt> is a source of characters. Characters from
* a <tt>Readable</tt> are made available to callers of the read
* A {@code Readable} is a source of characters. Characters from
* a {@code Readable} are made available to callers of the read
* method via a {@link java.nio.CharBuffer CharBuffer}.
*
* @since 1.5

View File

@ -71,7 +71,7 @@ public class RuntimeException extends Exception {
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
@ -81,13 +81,13 @@ public class RuntimeException extends Exception {
}
/** Constructs a new runtime exception with the specified cause and a
* detail message of <tt>(cause==null ? null : cause.toString())</tt>
* detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
* <tt>cause</tt>). This constructor is useful for runtime exceptions
* {@code cause}). This constructor is useful for runtime exceptions
* that are little more than wrappers for other throwables.
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4

View File

@ -172,9 +172,8 @@ import java.util.StringTokenizer;
* <tr>
* <td>modifyThread</td>
* <td>Modification of threads, e.g., via calls to Thread
* <tt>interrupt</tt>, <tt>stop</tt>, <tt>suspend</tt>,
* <tt>resume</tt>, <tt>setDaemon</tt>, <tt>setPriority</tt>,
* <tt>setName</tt> and <tt>setUncaughtExceptionHandler</tt>
* {@code interrupt, stop, suspend, resume, setDaemon, setPriority,
* setName} and {@code setUncaughtExceptionHandler}
* methods</td>
* <td>This allows an attacker to modify the behaviour of
* any thread in the system.</td>

View File

@ -36,14 +36,14 @@ public class SecurityException extends RuntimeException {
private static final long serialVersionUID = 6878364983674394167L;
/**
* Constructs a <code>SecurityException</code> with no detail message.
* Constructs a {@code SecurityException} with no detail message.
*/
public SecurityException() {
super();
}
/**
* Constructs a <code>SecurityException</code> with the specified
* Constructs a {@code SecurityException} with the specified
* detail message.
*
* @param s the detail message.
@ -53,13 +53,13 @@ public class SecurityException extends RuntimeException {
}
/**
* Creates a <code>SecurityException</code> with the specified
* Creates a {@code SecurityException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is permitted,
* {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@ -68,13 +68,13 @@ public class SecurityException extends RuntimeException {
}
/**
* Creates a <code>SecurityException</code> with the specified cause
* and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
* Creates a {@code SecurityException} with the specified cause
* and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
* <tt>cause</tt>).
* {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is permitted,
* {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/

View File

@ -87,7 +87,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
* string concatenation and conversion, see Gosling, Joy, and Steele,
* <i>The Java Language Specification</i>.
*
* <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
* <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
@ -1135,7 +1135,7 @@ public final class String
* or both. If they have different characters at one or more index
* positions, let <i>k</i> be the smallest such index; then the string
* whose character at position <i>k</i> has the smaller value, as
* determined by using the &lt; operator, lexicographically precedes the
* determined by using the {@code <} operator, lexicographically precedes the
* other string. In this case, {@code compareTo} returns the
* difference of the two character values at position {@code k} in
* the two string -- that is, the value:

View File

@ -205,7 +205,7 @@ public final class System {
* Returns the unique {@link java.io.Console Console} object associated
* with the current Java virtual machine, if any.
*
* @return The system console, if any, otherwise <tt>null</tt>.
* @return The system console, if any, otherwise {@code null}.
*
* @since 1.6
*/
@ -232,7 +232,7 @@ public final class System {
* inheritedChannel}, this method may return other kinds of
* channels in the future.
*
* @return The inherited channel, if any, otherwise <tt>null</tt>.
* @return The inherited channel, if any, otherwise {@code null}.
*
* @throws IOException
* If an I/O error occurs

View File

@ -616,7 +616,7 @@ class Thread implements Runnable {
* Similarly, specifying a lower value may allow a greater number of
* threads to exist concurrently without throwing an {@link
* OutOfMemoryError} (or other internal error). The details of
* the relationship between the value of the <tt>stackSize</tt> parameter
* the relationship between the value of the {@code stackSize} parameter
* and the maximum recursion depth and concurrency level are
* platform-dependent. <b>On some platforms, the value of the
* {@code stackSize} parameter may have no effect whatsoever.</b>
@ -1476,7 +1476,7 @@ class Thread implements Runnable {
}
/**
* Returns <tt>true</tt> if and only if the current thread holds the
* Returns {@code true} if and only if the current thread holds the
* monitor lock on the specified object.
*
* <p>This method is designed to allow a program to assert that
@ -1486,8 +1486,8 @@ class Thread implements Runnable {
* </pre>
*
* @param obj the object on which to test lock ownership
* @throws NullPointerException if obj is <tt>null</tt>
* @return <tt>true</tt> if the current thread holds the monitor lock on
* @throws NullPointerException if obj is {@code null}
* @return {@code true} if the current thread holds the monitor lock on
* the specified object.
* @since 1.4
*/
@ -1509,8 +1509,8 @@ class Thread implements Runnable {
*
* <p>If there is a security manager, and this thread is not
* the current thread, then the security manager's
* <tt>checkPermission</tt> method is called with a
* <tt>RuntimePermission("getStackTrace")</tt> permission
* {@code checkPermission} method is called with a
* {@code RuntimePermission("getStackTrace")} permission
* to see if it's ok to get the stack trace.
*
* <p>Some virtual machines may, under some circumstances, omit one
@ -1519,12 +1519,12 @@ class Thread implements Runnable {
* this thread is permitted to return a zero-length array from this
* method.
*
* @return an array of <tt>StackTraceElement</tt>,
* @return an array of {@code StackTraceElement},
* each represents one stack frame.
*
* @throws SecurityException
* if a security manager exists and its
* <tt>checkPermission</tt> method doesn't allow
* {@code checkPermission} method doesn't allow
* getting the stack trace of thread.
* @see SecurityManager#checkPermission
* @see RuntimePermission
@ -1562,8 +1562,8 @@ class Thread implements Runnable {
/**
* Returns a map of stack traces for all live threads.
* The map keys are threads and each map value is an array of
* <tt>StackTraceElement</tt> that represents the stack dump
* of the corresponding <tt>Thread</tt>.
* {@code StackTraceElement} that represents the stack dump
* of the corresponding {@code Thread}.
* The returned stack traces are in the format specified for
* the {@link #getStackTrace getStackTrace} method.
*
@ -1574,18 +1574,18 @@ class Thread implements Runnable {
* no stack trace information about a thread.
*
* <p>If there is a security manager, then the security manager's
* <tt>checkPermission</tt> method is called with a
* <tt>RuntimePermission("getStackTrace")</tt> permission as well as
* <tt>RuntimePermission("modifyThreadGroup")</tt> permission
* {@code checkPermission} method is called with a
* {@code RuntimePermission("getStackTrace")} permission as well as
* {@code RuntimePermission("modifyThreadGroup")} permission
* to see if it is ok to get the stack trace of all threads.
*
* @return a <tt>Map</tt> from <tt>Thread</tt> to an array of
* <tt>StackTraceElement</tt> that represents the stack trace of
* @return a {@code Map} from {@code Thread} to an array of
* {@code StackTraceElement} that represents the stack trace of
* the corresponding thread.
*
* @throws SecurityException
* if a security manager exists and its
* <tt>checkPermission</tt> method doesn't allow
* {@code checkPermission} method doesn't allow
* getting the stack trace of thread.
* @see #getStackTrace
* @see SecurityManager#checkPermission
@ -1693,7 +1693,7 @@ class Thread implements Runnable {
/**
* Returns the identifier of this Thread. The thread ID is a positive
* <tt>long</tt> number generated when this thread was created.
* {@code long} number generated when this thread was created.
* The thread ID is unique and remains unchanged during its lifetime.
* When a thread is terminated, this thread ID may be reused.
*
@ -1774,10 +1774,10 @@ class Thread implements Runnable {
* <p>A thread in the waiting state is waiting for another thread to
* perform a particular action.
*
* For example, a thread that has called <tt>Object.wait()</tt>
* For example, a thread that has called {@code Object.wait()}
* on an object is waiting for another thread to call
* <tt>Object.notify()</tt> or <tt>Object.notifyAll()</tt> on
* that object. A thread that has called <tt>Thread.join()</tt>
* {@code Object.notify()} or {@code Object.notifyAll()} on
* that object. A thread that has called {@code Thread.join()}
* is waiting for a specified thread to terminate.
*/
WAITING,
@ -1819,17 +1819,17 @@ class Thread implements Runnable {
// Added in JSR-166
/**
* Interface for handlers invoked when a <tt>Thread</tt> abruptly
* Interface for handlers invoked when a {@code Thread} abruptly
* terminates due to an uncaught exception.
* <p>When a thread is about to terminate due to an uncaught exception
* the Java Virtual Machine will query the thread for its
* <tt>UncaughtExceptionHandler</tt> using
* {@code UncaughtExceptionHandler} using
* {@link #getUncaughtExceptionHandler} and will invoke the handler's
* <tt>uncaughtException</tt> method, passing the thread and the
* {@code uncaughtException} method, passing the thread and the
* exception as arguments.
* If a thread has not had its <tt>UncaughtExceptionHandler</tt>
* explicitly set, then its <tt>ThreadGroup</tt> object acts as its
* <tt>UncaughtExceptionHandler</tt>. If the <tt>ThreadGroup</tt> object
* If a thread has not had its {@code UncaughtExceptionHandler}
* explicitly set, then its {@code ThreadGroup} object acts as its
* {@code UncaughtExceptionHandler}. If the {@code ThreadGroup} object
* has no
* special requirements for dealing with the exception, it can forward
* the invocation to the {@linkplain #getDefaultUncaughtExceptionHandler
@ -1869,8 +1869,8 @@ class Thread implements Runnable {
* uncaught exception handler. If the thread does not have an explicit
* uncaught exception handler set, and the thread's thread group
* (including parent thread groups) does not specialize its
* <tt>uncaughtException</tt> method, then the default handler's
* <tt>uncaughtException</tt> method will be invoked.
* {@code uncaughtException} method, then the default handler's
* {@code uncaughtException} method will be invoked.
* <p>By setting the default uncaught exception handler, an application
* can change the way in which uncaught exceptions are handled (such as
* logging to a specific device, or file) for those threads that would
@ -1878,15 +1878,14 @@ class Thread implements Runnable {
* provided.
*
* <p>Note that the default uncaught exception handler should not usually
* defer to the thread's <tt>ThreadGroup</tt> object, as that could cause
* defer to the thread's {@code ThreadGroup} object, as that could cause
* infinite recursion.
*
* @param eh the object to use as the default uncaught exception handler.
* If <tt>null</tt> then there is no default handler.
* If {@code null} then there is no default handler.
*
* @throws SecurityException if a security manager is present and it
* denies <tt>{@link RuntimePermission}
* (&quot;setDefaultUncaughtExceptionHandler&quot;)</tt>
* @throws SecurityException if a security manager is present and it denies
* {@link RuntimePermission}{@code ("setDefaultUncaughtExceptionHandler")}
*
* @see #setUncaughtExceptionHandler
* @see #getUncaughtExceptionHandler
@ -1906,7 +1905,7 @@ class Thread implements Runnable {
/**
* Returns the default handler invoked when a thread abruptly terminates
* due to an uncaught exception. If the returned value is <tt>null</tt>,
* due to an uncaught exception. If the returned value is {@code null},
* there is no default.
* @since 1.5
* @see #setDefaultUncaughtExceptionHandler
@ -1920,8 +1919,8 @@ class Thread implements Runnable {
* Returns the handler invoked when this thread abruptly terminates
* due to an uncaught exception. If this thread has not had an
* uncaught exception handler explicitly set then this thread's
* <tt>ThreadGroup</tt> object is returned, unless this thread
* has terminated, in which case <tt>null</tt> is returned.
* {@code ThreadGroup} object is returned, unless this thread
* has terminated, in which case {@code null} is returned.
* @since 1.5
* @return the uncaught exception handler for this thread
*/
@ -1935,10 +1934,10 @@ class Thread implements Runnable {
* due to an uncaught exception.
* <p>A thread can take full control of how it responds to uncaught
* exceptions by having its uncaught exception handler explicitly set.
* If no such handler is set then the thread's <tt>ThreadGroup</tt>
* If no such handler is set then the thread's {@code ThreadGroup}
* object acts as its handler.
* @param eh the object to use as this thread's uncaught exception
* handler. If <tt>null</tt> then this thread has no explicit handler.
* handler. If {@code null} then this thread has no explicit handler.
* @throws SecurityException if the current thread is not allowed to
* modify this thread.
* @see #setDefaultUncaughtExceptionHandler

View File

@ -728,7 +728,7 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
* @see java.lang.ThreadGroup#checkAccess()
* @since 1.0
* @deprecated This method is used solely in conjunction with
* <tt>Thread.suspend</tt> and <tt>ThreadGroup.suspend</tt>,
* {@code Thread.suspend} and {@code ThreadGroup.suspend},
* both of which have been deprecated, as they are inherently
* deadlock-prone. See {@link Thread#suspend} for details.
*/

View File

@ -29,7 +29,7 @@ package java.lang;
* Thrown when an application tries to access a type using a string
* representing the type's name, but no definition for the type with
* the specified name can be found. This exception differs from
* {@link ClassNotFoundException} in that <tt>ClassNotFoundException</tt> is a
* {@link ClassNotFoundException} in that {@code ClassNotFoundException} is a
* checked exception, whereas this exception is unchecked.
*
* <p>Note that this exception may be used when undefined type variables
@ -49,12 +49,12 @@ public class TypeNotPresentException extends RuntimeException {
private String typeName;
/**
* Constructs a <tt>TypeNotPresentException</tt> for the named type
* Constructs a {@code TypeNotPresentException} for the named type
* with the specified cause.
*
* @param typeName the fully qualified name of the unavailable type
* @param cause the exception that was thrown when the system attempted to
* load the named type, or <tt>null</tt> if unavailable or inapplicable
* load the named type, or {@code null} if unavailable or inapplicable
*/
public TypeNotPresentException(String typeName, Throwable cause) {
super("Type " + typeName + " not present", cause);

View File

@ -63,7 +63,7 @@ public class UnsupportedOperationException extends RuntimeException {
* @param message the detail message (which is saved for later retrieval
* by the {@link Throwable#getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link Throwable#getCause()} method). (A <tt>null</tt> value
* {@link Throwable#getCause()} method). (A {@code null} value
* is permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
@ -74,14 +74,14 @@ public class UnsupportedOperationException extends RuntimeException {
/**
* Constructs a new exception with the specified cause and a detail
* message of <tt>(cause==null ? null : cause.toString())</tt> (which
* typically contains the class and detail message of <tt>cause</tt>).
* message of {@code (cause==null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
* {@link Throwable#getCause()} method). (A <tt>null</tt> value is
* {@link Throwable#getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5

View File

@ -50,28 +50,28 @@ public interface Annotation {
* to the corresponding member of this annotation, as defined below:
* <ul>
* <li>Two corresponding primitive typed members whose values are
* <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
* unless their type is <tt>float</tt> or <tt>double</tt>.
* {@code x} and {@code y} are considered equal if {@code x == y},
* unless their type is {@code float} or {@code double}.
*
* <li>Two corresponding <tt>float</tt> members whose values
* are <tt>x</tt> and <tt>y</tt> are considered equal if
* <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
* (Unlike the <tt>==</tt> operator, NaN is considered equal
* to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)
* <li>Two corresponding {@code float} members whose values
* are {@code x} and {@code y} are considered equal if
* {@code Float.valueOf(x).equals(Float.valueOf(y))}.
* (Unlike the {@code ==} operator, NaN is considered equal
* to itself, and {@code 0.0f} unequal to {@code -0.0f}.)
*
* <li>Two corresponding <tt>double</tt> members whose values
* are <tt>x</tt> and <tt>y</tt> are considered equal if
* <tt>Double.valueOf(x).equals(Double.valueOf(y))</tt>.
* (Unlike the <tt>==</tt> operator, NaN is considered equal
* to itself, and <tt>0.0</tt> unequal to <tt>-0.0</tt>.)
* <li>Two corresponding {@code double} members whose values
* are {@code x} and {@code y} are considered equal if
* {@code Double.valueOf(x).equals(Double.valueOf(y))}.
* (Unlike the {@code ==} operator, NaN is considered equal
* to itself, and {@code 0.0} unequal to {@code -0.0}.)
*
* <li>Two corresponding <tt>String</tt>, <tt>Class</tt>, enum, or
* annotation typed members whose values are <tt>x</tt> and <tt>y</tt>
* are considered equal if <tt>x.equals(y)</tt>. (Note that this
* <li>Two corresponding {@code String}, {@code Class}, enum, or
* annotation typed members whose values are {@code x} and {@code y}
* are considered equal if {@code x.equals(y)}. (Note that this
* definition is recursive for annotation typed members.)
*
* <li>Two corresponding array typed members <tt>x</tt> and <tt>y</tt>
* are considered equal if <tt>Arrays.equals(x, y)</tt>, for the
* <li>Two corresponding array typed members {@code x} and {@code y}
* are considered equal if {@code Arrays.equals(x, y)}, for the
* appropriate overloading of {@link java.util.Arrays#equals}.
* </ul>
*
@ -93,16 +93,16 @@ public interface Annotation {
*
* <p>The hash code of a member-value depends on its type:
* <ul>
* <li>The hash code of a primitive value <tt><i>v</i></tt> is equal to
* <tt><i>WrapperType</i>.valueOf(<i>v</i>).hashCode()</tt>, where
* <tt><i>WrapperType</i></tt> is the wrapper type corresponding
* to the primitive type of <tt><i>v</i></tt> ({@link Byte},
* <li>The hash code of a primitive value <i>{@code v}</i> is equal to
* <code><i>WrapperType</i>.valueOf(<i>v</i>).hashCode()</code>, where
* <i>{@code WrapperType}</i> is the wrapper type corresponding
* to the primitive type of <i>{@code v}</i> ({@link Byte},
* {@link Character}, {@link Double}, {@link Float}, {@link Integer},
* {@link Long}, {@link Short}, or {@link Boolean}).
*
* <li>The hash code of a string, enum, class, or annotation member-value
I <tt><i>v</i></tt> is computed as by calling
* <tt><i>v</i>.hashCode()</tt>. (In the case of annotation
I <i>{@code v}</i> is computed as by calling
* <code><i>v</i>.hashCode()</code>. (In the case of annotation
* member values, this is a recursive definition.)
*
* <li>The hash code of an array member-value is computed by calling

View File

@ -40,7 +40,7 @@ public class AnnotationFormatError extends Error {
private static final long serialVersionUID = -4256701562333669892L;
/**
* Constructs a new <tt>AnnotationFormatError</tt> with the specified
* Constructs a new {@code AnnotationFormatError} with the specified
* detail message.
*
* @param message the detail message.
@ -50,13 +50,13 @@ public class AnnotationFormatError extends Error {
}
/**
* Constructs a new <tt>AnnotationFormatError</tt> with the specified
* Constructs a new {@code AnnotationFormatError} with the specified
* detail message and cause. Note that the detail message associated
* with <code>cause</code> is <i>not</i> automatically incorporated in
* with {@code cause} is <i>not</i> automatically incorporated in
* this error's detail message.
*
* @param message the detail message
* @param cause the cause (A <tt>null</tt> value is permitted, and
* @param cause the cause (A {@code null} value is permitted, and
* indicates that the cause is nonexistent or unknown.)
*/
public AnnotationFormatError(String message, Throwable cause) {
@ -65,12 +65,12 @@ public class AnnotationFormatError extends Error {
/**
* Constructs a new <tt>AnnotationFormatError</tt> with the specified
* Constructs a new {@code AnnotationFormatError} with the specified
* cause and a detail message of
* <tt>(cause == null ? null : cause.toString())</tt> (which
* typically contains the class and detail message of <tt>cause</tt>).
* {@code (cause == null ? null : cause.toString())} (which
* typically contains the class and detail message of {@code cause}).
*
* @param cause the cause (A <tt>null</tt> value is permitted, and
* @param cause the cause (A {@code null} value is permitted, and
* indicates that the cause is nonexistent or unknown.)
*/
public AnnotationFormatError(Throwable cause) {

View File

@ -42,7 +42,7 @@ public class AnnotationTypeMismatchException extends RuntimeException {
private static final long serialVersionUID = 8125925355765570191L;
/**
* The <tt>Method</tt> object for the annotation element.
* The {@code Method} object for the annotation element.
*/
private final Method element;
@ -57,7 +57,7 @@ public class AnnotationTypeMismatchException extends RuntimeException {
* Constructs an AnnotationTypeMismatchException for the specified
* annotation type element and found data type.
*
* @param element the <tt>Method</tt> object for the annotation element
* @param element the {@code Method} object for the annotation element
* @param foundType the (erroneous) type of data found in the annotation.
* This string may, but is not required to, contain the value
* as well. The exact format of the string is unspecified.
@ -70,9 +70,9 @@ public class AnnotationTypeMismatchException extends RuntimeException {
}
/**
* Returns the <tt>Method</tt> object for the incorrectly typed element.
* Returns the {@code Method} object for the incorrectly typed element.
*
* @return the <tt>Method</tt> object for the incorrectly typed element
* @return the {@code Method} object for the incorrectly typed element
*/
public Method element() {
return this.element;

View File

@ -746,7 +746,7 @@ class MethodType implements java.io.Serializable {
/**
* Compares the specified object with this type for equality.
* That is, it returns <tt>true</tt> if and only if the specified object
* That is, it returns {@code true} if and only if the specified object
* is also a method type with exactly the same parameters and return type.
* @param x object to compare
* @see Object#equals(Object)

View File

@ -38,8 +38,8 @@ package java.lang.ref;
* time or at some later time it will enqueue the reference.
*
* <p> In order to ensure that a reclaimable object remains so, the referent of
* a phantom reference may not be retrieved: The <code>get</code> method of a
* phantom reference always returns <code>null</code>.
* a phantom reference may not be retrieved: The {@code get} method of a
* phantom reference always returns {@code null}.
*
* <p> Unlike soft and weak references, phantom references are not
* automatically cleared by the garbage collector as they are enqueued. An
@ -55,9 +55,9 @@ public class PhantomReference<T> extends Reference<T> {
/**
* Returns this reference object's referent. Because the referent of a
* phantom reference is always inaccessible, this method always returns
* <code>null</code>.
* {@code null}.
*
* @return <code>null</code>
* @return {@code null}
*/
public T get() {
return null;
@ -67,14 +67,14 @@ public class PhantomReference<T> extends Reference<T> {
* Creates a new phantom reference that refers to the given object and
* is registered with the given queue.
*
* <p> It is possible to create a phantom reference with a <tt>null</tt>
* queue, but such a reference is completely useless: Its <tt>get</tt>
* <p> It is possible to create a phantom reference with a {@code null}
* queue, but such a reference is completely useless: Its {@code get}
* method will always return null and, since it does not have a queue, it
* will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
* or <tt>null</tt> if registration is not required
* or {@code null} if registration is not required
*/
public PhantomReference(T referent, ReferenceQueue<? super T> q) {
super(referent, q);

View File

@ -96,10 +96,10 @@ public class ReferenceQueue<T> {
/**
* Polls this queue to see if a reference object is available. If one is
* available without further delay then it is removed from the queue and
* returned. Otherwise this method immediately returns <tt>null</tt>.
* returned. Otherwise this method immediately returns {@code null}.
*
* @return A reference object, if one was immediately available,
* otherwise <code>null</code>
* otherwise {@code null}
*/
public Reference<? extends T> poll() {
if (head == null)
@ -116,12 +116,12 @@ public class ReferenceQueue<T> {
* <p> This method does not offer real-time guarantees: It schedules the
* timeout as if by invoking the {@link Object#wait(long)} method.
*
* @param timeout If positive, block for up to <code>timeout</code>
* @param timeout If positive, block for up to {@code timeout}
* milliseconds while waiting for a reference to be
* added to this queue. If zero, block indefinitely.
*
* @return A reference object, if one was available within the specified
* timeout period, otherwise <code>null</code>
* timeout period, otherwise {@code null}
*
* @throws IllegalArgumentException
* If the value of the timeout argument is negative

View File

@ -42,7 +42,7 @@ package java.lang.ref;
*
* <p> All soft references to softly-reachable objects are guaranteed to have
* been cleared before the virtual machine throws an
* <code>OutOfMemoryError</code>. Otherwise no constraints are placed upon the
* {@code OutOfMemoryError}. Otherwise no constraints are placed upon the
* time at which a soft reference will be cleared or the order in which a set
* of such references to different objects will be cleared. Virtual machine
* implementations are, however, encouraged to bias against clearing
@ -92,7 +92,7 @@ public class SoftReference<T> extends Reference<T> {
*
* @param referent object the new soft reference will refer to
* @param q the queue with which the reference is to be registered,
* or <tt>null</tt> if registration is not required
* or {@code null} if registration is not required
*
*/
public SoftReference(T referent, ReferenceQueue<? super T> q) {
@ -103,10 +103,10 @@ public class SoftReference<T> extends Reference<T> {
/**
* Returns this reference object's referent. If this reference object has
* been cleared, either by the program or by the garbage collector, then
* this method returns <code>null</code>.
* this method returns {@code null}.
*
* @return The object to which this reference refers, or
* <code>null</code> if this reference object has been cleared
* {@code null} if this reference object has been cleared
*/
public T get() {
T o = super.get();

View File

@ -63,7 +63,7 @@ public class WeakReference<T> extends Reference<T> {
*
* @param referent object the new weak reference will refer to
* @param q the queue with which the reference is to be registered,
* or <tt>null</tt> if registration is not required
* or {@code null} if registration is not required
*/
public WeakReference(T referent, ReferenceQueue<? super T> q) {
super(referent, q);

View File

@ -286,9 +286,9 @@ public final class Constructor<T> extends Executable {
* followed by the fully-qualified name of the declaring class,
* followed by a parenthesized, comma-separated list of the
* constructor's formal parameter types. For example:
* <pre>
* <pre>{@code
* public java.util.Hashtable(int,float)
* </pre>
* }</pre>
*
* <p>The only possible modifiers for constructors are the access
* modifiers {@code public}, {@code protected} or
@ -322,8 +322,8 @@ public final class Constructor<T> extends Executable {
*
* If this constructor was declared to take a variable number of
* arguments, instead of denoting the last parameter as
* "<tt><i>Type</i>[]</tt>", it is denoted as
* "<tt><i>Type</i>...</tt>".
* "<code><i>Type</i>[]</code>", it is denoted as
* "<code><i>Type</i>...</code>".
*
* A space is used to separate access modifiers from one another
* and from the type parameters or return type. If there are no

View File

@ -387,8 +387,8 @@ public final class Method extends Executable {
*
* If this method was declared to take a variable number of
* arguments, instead of denoting the last parameter as
* "<tt><i>Type</i>[]</tt>", it is denoted as
* "<tt><i>Type</i>...</tt>".
* "<code><i>Type</i>[]</code>", it is denoted as
* "<code><i>Type</i>...</code>".
*
* A space is used to separate access modifiers from one another
* and from the type parameters or return type. If there are no

View File

@ -40,7 +40,7 @@ import java.util.Arrays;
* decimal point. If negative, the unscaled value of the number is
* multiplied by ten to the power of the negation of the scale. The
* value of the number represented by the {@code BigDecimal} is
* therefore <tt>(unscaledValue &times; 10<sup>-scale</sup>)</tt>.
* therefore <code>(unscaledValue &times; 10<sup>-scale</sup>)</code>.
*
* <p>The {@code BigDecimal} class provides operations for
* arithmetic, scale manipulation, rounding, comparison, hashing, and
@ -709,8 +709,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
/**
* Translates the string representation of a {@code BigDecimal}
* into a {@code BigDecimal}. The string representation consists
* of an optional sign, {@code '+'} (<tt> '&#92;u002B'</tt>) or
* {@code '-'} (<tt>'&#92;u002D'</tt>), followed by a sequence of
* of an optional sign, {@code '+'} (<code> '&#92;u002B'</code>) or
* {@code '-'} (<code>'&#92;u002D'</code>), followed by a sequence of
* zero or more decimal digits ("the integer"), optionally
* followed by a fraction, optionally followed by an exponent.
*
@ -721,7 +721,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* <i>significand</i>.
*
* <p>The exponent consists of the character {@code 'e'}
* (<tt>'&#92;u0065'</tt>) or {@code 'E'} (<tt>'&#92;u0045'</tt>)
* (<code>'&#92;u0065'</code>) or {@code 'E'} (<code>'&#92;u0045'</code>)
* followed by one or more decimal digits. The value of the
* exponent must lie between -{@link Integer#MAX_VALUE} ({@link
* Integer#MIN_VALUE}+1) and {@link Integer#MAX_VALUE}, inclusive.
@ -834,7 +834,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* is the exact decimal representation of the {@code double}'s
* binary floating-point value. The scale of the returned
* {@code BigDecimal} is the smallest value such that
* <tt>(10<sup>scale</sup> &times; val)</tt> is an integer.
* <code>(10<sup>scale</sup> &times; val)</code> is an integer.
* <p>
* <b>Notes:</b>
* <ol>
@ -857,7 +857,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* creates a {@code BigDecimal} which is <i>exactly</i> equal to
* 0.1, as one would expect. Therefore, it is generally
* recommended that the {@linkplain #BigDecimal(String)
* <tt>String</tt> constructor} be used in preference to this one.
* String constructor} be used in preference to this one.
*
* <li>
* When a {@code double} must be used as a source for a
@ -881,7 +881,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* Translates a {@code double} into a {@code BigDecimal}, with
* rounding according to the context settings. The scale of the
* {@code BigDecimal} is the smallest value such that
* <tt>(10<sup>scale</sup> &times; val)</tt> is an integer.
* <code>(10<sup>scale</sup> &times; val)</code> is an integer.
*
* <p>The results of this constructor can be somewhat unpredictable
* and its use is generally not recommended; see the notes under
@ -1010,7 +1010,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* Translates a {@code BigInteger} unscaled value and an
* {@code int} scale into a {@code BigDecimal}. The value of
* the {@code BigDecimal} is
* <tt>(unscaledVal &times; 10<sup>-scale</sup>)</tt>.
* <code>(unscaledVal &times; 10<sup>-scale</sup>)</code>.
*
* @param unscaledVal unscaled value of the {@code BigDecimal}.
* @param scale scale of the {@code BigDecimal}.
@ -1026,8 +1026,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* Translates a {@code BigInteger} unscaled value and an
* {@code int} scale into a {@code BigDecimal}, with rounding
* according to the context settings. The value of the
* {@code BigDecimal} is <tt>(unscaledVal &times;
* 10<sup>-scale</sup>)</tt>, rounded according to the
* {@code BigDecimal} is <code>(unscaledVal &times;
* 10<sup>-scale</sup>)</code>, rounded according to the
* {@code precision} and rounding mode settings.
*
* @param unscaledVal unscaled value of the {@code BigDecimal}.
@ -1196,7 +1196,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* @param unscaledVal unscaled value of the {@code BigDecimal}.
* @param scale scale of the {@code BigDecimal}.
* @return a {@code BigDecimal} whose value is
* <tt>(unscaledVal &times; 10<sup>-scale</sup>)</tt>.
* <code>(unscaledVal &times; 10<sup>-scale</sup>)</code>.
*/
public static BigDecimal valueOf(long unscaledVal, int scale) {
if (scale == 0)
@ -1476,8 +1476,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
}
/**
* Returns a {@code BigDecimal} whose value is <tt>(this &times;
* multiplicand)</tt>, and whose scale is {@code (this.scale() +
* Returns a {@code BigDecimal} whose value is <code>(this &times;
* multiplicand)</code>, and whose scale is {@code (this.scale() +
* multiplicand.scale())}.
*
* @param multiplicand value to be multiplied by this {@code BigDecimal}.
@ -1501,8 +1501,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
}
/**
* Returns a {@code BigDecimal} whose value is <tt>(this &times;
* multiplicand)</tt>, with rounding according to the context settings.
* Returns a {@code BigDecimal} whose value is <code>(this &times;
* multiplicand)</code>, with rounding according to the context settings.
*
* @param multiplicand value to be multiplied by this {@code BigDecimal}.
* @param mc the context to use.
@ -1995,7 +1995,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
/**
* Returns a {@code BigDecimal} whose value is
* <tt>(this<sup>n</sup>)</tt>, The power is computed exactly, to
* <code>(this<sup>n</sup>)</code>, The power is computed exactly, to
* unlimited precision.
*
* <p>The parameter {@code n} must be in the range 0 through
@ -2006,7 +2006,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* range of this method.
*
* @param n power to raise this {@code BigDecimal} to.
* @return <tt>this<sup>n</sup></tt>
* @return <code>this<sup>n</sup></code>
* @throws ArithmeticException if {@code n} is out of range.
* @since 1.5
*/
@ -2022,7 +2022,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
/**
* Returns a {@code BigDecimal} whose value is
* <tt>(this<sup>n</sup>)</tt>. The current implementation uses
* <code>(this<sup>n</sup>)</code>. The current implementation uses
* the core algorithm defined in ANSI standard X3.274-1996 with
* rounding according to the context settings. In general, the
* returned numerical value is within two ulps of the exact
@ -2063,7 +2063,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
*
* @param n power to raise this {@code BigDecimal} to.
* @param mc the context to use.
* @return <tt>this<sup>n</sup></tt> using the ANSI standard X3.274-1996
* @return <code>this<sup>n</sup></code> using the ANSI standard X3.274-1996
* algorithm
* @throws ArithmeticException if the result is inexact but the
* rounding mode is {@code UNNECESSARY}, or {@code n} is out
@ -2251,8 +2251,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
/**
* Returns a {@code BigInteger} whose value is the <i>unscaled
* value</i> of this {@code BigDecimal}. (Computes <tt>(this *
* 10<sup>this.scale()</sup>)</tt>.)
* value</i> of this {@code BigDecimal}. (Computes <code>(this *
* 10<sup>this.scale()</sup>)</code>.)
*
* @return the unscaled value of this {@code BigDecimal}.
* @since 1.2
@ -2371,7 +2371,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* <p>Note that since BigDecimal objects are immutable, calls of
* this method do <i>not</i> result in the original object being
* modified, contrary to the usual convention of having methods
* named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
* named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
* Instead, {@code setScale} returns an object with the proper
* scale; the returned object may or may not be newly allocated.
*
@ -2404,7 +2404,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* <p>Note that since BigDecimal objects are immutable, calls of
* this method do <i>not</i> result in the original object being
* modified, contrary to the usual convention of having methods
* named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
* named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
* Instead, {@code setScale} returns an object with the proper
* scale; the returned object may or may not be newly allocated.
*
@ -2498,7 +2498,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* <p>Note that since {@code BigDecimal} objects are immutable,
* calls of this method do <i>not</i> result in the original
* object being modified, contrary to the usual convention of
* having methods named <tt>set<i>X</i></tt> mutate field
* having methods named <code>set<i>X</i></code> mutate field
* <i>{@code X}</i>. Instead, {@code setScale} returns an
* object with the proper scale; the returned object may or may
* not be newly allocated.
@ -2525,8 +2525,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* {@code n} is non-negative, the call merely adds {@code n} to
* the scale. If {@code n} is negative, the call is equivalent
* to {@code movePointRight(-n)}. The {@code BigDecimal}
* returned by this call has value <tt>(this &times;
* 10<sup>-n</sup>)</tt> and scale {@code max(this.scale()+n,
* returned by this call has value <code>(this &times;
* 10<sup>-n</sup>)</code> and scale {@code max(this.scale()+n,
* 0)}.
*
* @param n number of places to move the decimal point to the left.
@ -2547,8 +2547,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* If {@code n} is non-negative, the call merely subtracts
* {@code n} from the scale. If {@code n} is negative, the call
* is equivalent to {@code movePointLeft(-n)}. The
* {@code BigDecimal} returned by this call has value <tt>(this
* &times; 10<sup>n</sup>)</tt> and scale {@code max(this.scale()-n,
* {@code BigDecimal} returned by this call has value <code>(this
* &times; 10<sup>n</sup>)</code> and scale {@code max(this.scale()-n,
* 0)}.
*
* @param n number of places to move the decimal point to the right.
@ -2825,12 +2825,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* adjusted exponent converted to a character form. The latter is
* in base ten, using the characters {@code '0'} through
* {@code '9'} with no leading zeros, and is always prefixed by a
* sign character {@code '-'} (<tt>'&#92;u002D'</tt>) if the
* sign character {@code '-'} (<code>'&#92;u002D'</code>) if the
* adjusted exponent is negative, {@code '+'}
* (<tt>'&#92;u002B'</tt>) otherwise).
* (<code>'&#92;u002B'</code>) otherwise).
*
* <p>Finally, the entire string is prefixed by a minus sign
* character {@code '-'} (<tt>'&#92;u002D'</tt>) if the unscaled
* character {@code '-'} (<code>'&#92;u002D'</code>) if the unscaled
* value is less than zero. No sign character is prefixed if the
* unscaled value is zero or positive.
*
@ -2930,7 +2930,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* in the result.
*
* The entire string is prefixed by a minus sign character '-'
* (<tt>'&#92;u002D'</tt>) if the unscaled value is less than
* (<code>'&#92;u002D'</code>) if the unscaled value is less than
* zero. No sign character is prefixed if the unscaled value is
* zero or positive.
*

View File

@ -2289,11 +2289,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
}
/**
* Returns a BigInteger whose value is <tt>(this<sup>exponent</sup>)</tt>.
* Returns a BigInteger whose value is <code>(this<sup>exponent</sup>)</code>.
* Note that {@code exponent} is an integer rather than a BigInteger.
*
* @param exponent exponent to which this BigInteger is to be raised.
* @return <tt>this<sup>exponent</sup></tt>
* @return <code>this<sup>exponent</sup></code>
* @throws ArithmeticException {@code exponent} is negative. (This would
* cause the operation to yield a non-integer value.)
*/
@ -2552,12 +2552,12 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Returns a BigInteger whose value is
* <tt>(this<sup>exponent</sup> mod m)</tt>. (Unlike {@code pow}, this
* <code>(this<sup>exponent</sup> mod m)</code>. (Unlike {@code pow}, this
* method permits negative exponents.)
*
* @param exponent the exponent.
* @param m the modulus.
* @return <tt>this<sup>exponent</sup> mod m</tt>
* @return <code>this<sup>exponent</sup> mod m</code>
* @throws ArithmeticException {@code m} &le; 0 or the exponent is
* negative and this BigInteger is not <i>relatively
* prime</i> to {@code m}.
@ -3152,7 +3152,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* Returns a BigInteger whose value is {@code (this << n)}.
* The shift distance, {@code n}, may be negative, in which case
* this method performs a right shift.
* (Computes <tt>floor(this * 2<sup>n</sup>)</tt>.)
* (Computes <code>floor(this * 2<sup>n</sup>)</code>.)
*
* @param n shift distance, in bits.
* @return {@code this << n}
@ -3175,7 +3175,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Returns a magnitude array whose value is {@code (mag << n)}.
* The shift distance, {@code n}, is considered unnsigned.
* (Computes <tt>this * 2<sup>n</sup></tt>.)
* (Computes <code>this * 2<sup>n</sup></code>.)
*
* @param mag magnitude, the most-significant int ({@code mag[0]}) must be non-zero.
* @param n unsigned shift distance, in bits.
@ -3212,7 +3212,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* Returns a BigInteger whose value is {@code (this >> n)}. Sign
* extension is performed. The shift distance, {@code n}, may be
* negative, in which case this method performs a left shift.
* (Computes <tt>floor(this / 2<sup>n</sup>)</tt>.)
* (Computes <code>floor(this / 2<sup>n</sup>)</code>.)
*
* @param n shift distance, in bits.
* @return {@code this >> n}
@ -3235,7 +3235,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Returns a BigInteger whose value is {@code (this >> n)}. The shift
* distance, {@code n}, is considered unsigned.
* (Computes <tt>floor(this * 2<sup>-n</sup>)</tt>.)
* (Computes <code>floor(this * 2<sup>-n</sup>)</code>.)
*
* @param n unsigned shift distance, in bits.
* @return {@code this >> n}

View File

@ -268,7 +268,7 @@ public final class MathContext implements Serializable {
* Returns the string representation of this {@code MathContext}.
* The {@code String} returned represents the settings of the
* {@code MathContext} object as two space-delimited words
* (separated by a single space character, <tt>'&#92;u0020'</tt>,
* (separated by a single space character, <code>'&#92;u0020'</code>,
* and with no leading or trailing white space), as follows:
* <ol>
* <li>

View File

@ -254,7 +254,7 @@ class MutableBigInteger {
/**
* Compare the magnitude of two MutableBigIntegers. Returns -1, 0 or 1
* as this MutableBigInteger is numerically less than, equal to, or
* greater than <tt>b</tt>.
* greater than {@code b}.
*/
final int compare(MutableBigInteger b) {
int blen = b.intLen;

View File

@ -360,6 +360,22 @@ public abstract class KeyStoreSpi {
* that specifies how to load the keystore,
* which may be {@code null}
*
* @implSpec
* The default implementation examines {@code KeyStore.LoadStoreParameter}
* to extract its password and pass it to
* {@link KeyStoreSpi#engineLoad(InputStream, char[])} along with a
* {@code null} {@code InputStream}.
* <p>
* If {@code KeyStore.LoadStoreParameter} is {@code null} then
* the password parameter will also be {@code null}.
* Otherwise the {@code KeyStore.ProtectionParameter} of
* {@code KeyStore.LoadStoreParameter} must be either a
* {@code KeyStore.PasswordProtection} or a
* {@code KeyStore.CallbackHandlerProtection} that supports
* {@code PasswordCallback} so that the password parameter can be
* extracted. If the {@code KeyStore.ProtectionParameter} is neither
* of those classes then a {@code NoSuchAlgorithmException} is thrown.
*
* @exception IllegalArgumentException if the given
* {@code KeyStore.LoadStoreParameter}
* input is not recognized
@ -385,37 +401,32 @@ public abstract class KeyStoreSpi {
return;
}
if (param instanceof KeyStore.SimpleLoadStoreParameter) {
ProtectionParameter protection = param.getProtectionParameter();
char[] password;
if (protection instanceof PasswordProtection) {
password = ((PasswordProtection)protection).getPassword();
} else if (protection instanceof CallbackHandlerProtection) {
CallbackHandler handler =
((CallbackHandlerProtection)protection).getCallbackHandler();
PasswordCallback callback =
new PasswordCallback("Password: ", false);
try {
handler.handle(new Callback[] {callback});
} catch (UnsupportedCallbackException e) {
throw new NoSuchAlgorithmException
("Could not obtain password", e);
}
password = callback.getPassword();
callback.clearPassword();
if (password == null) {
throw new NoSuchAlgorithmException
("No password provided");
}
} else {
throw new NoSuchAlgorithmException("ProtectionParameter must"
+ " be PasswordProtection or CallbackHandlerProtection");
ProtectionParameter protection = param.getProtectionParameter();
char[] password;
if (protection instanceof PasswordProtection) {
password = ((PasswordProtection)protection).getPassword();
} else if (protection instanceof CallbackHandlerProtection) {
CallbackHandler handler =
((CallbackHandlerProtection)protection).getCallbackHandler();
PasswordCallback callback =
new PasswordCallback("Password: ", false);
try {
handler.handle(new Callback[] {callback});
} catch (UnsupportedCallbackException e) {
throw new NoSuchAlgorithmException
("Could not obtain password", e);
}
engineLoad(null, password);
return;
password = callback.getPassword();
callback.clearPassword();
if (password == null) {
throw new NoSuchAlgorithmException("No password provided");
}
} else {
throw new NoSuchAlgorithmException("ProtectionParameter must"
+ " be PasswordProtection or CallbackHandlerProtection");
}
throw new UnsupportedOperationException();
engineLoad(null, password);
return;
}
/**

View File

@ -526,7 +526,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
}
/**
* <code>Name</code> object for <code>Manifest-Version</code>
* {@code Name} object for {@code Manifest-Version}
* manifest attribute. This attribute indicates the version number
* of the manifest standard to which a JAR file's manifest conforms.
* @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
@ -535,7 +535,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
/**
* <code>Name</code> object for <code>Signature-Version</code>
* {@code Name} object for {@code Signature-Version}
* manifest attribute used when signing JAR files.
* @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
* Manifest and Signature Specification</a>
@ -543,13 +543,13 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name SIGNATURE_VERSION = new Name("Signature-Version");
/**
* <code>Name</code> object for <code>Content-Type</code>
* {@code Name} object for {@code Content-Type}
* manifest attribute.
*/
public static final Name CONTENT_TYPE = new Name("Content-Type");
/**
* <code>Name</code> object for <code>Class-Path</code>
* {@code Name} object for {@code Class-Path}
* manifest attribute.
* @see <a href="../../../../technotes/guides/jar/jar.html#classpath">
* JAR file specification</a>
@ -557,16 +557,16 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name CLASS_PATH = new Name("Class-Path");
/**
* <code>Name</code> object for <code>Main-Class</code> manifest
* {@code Name} object for {@code Main-Class} manifest
* attribute used for launching applications packaged in JAR files.
* The <code>Main-Class</code> attribute is used in conjunction
* with the <code>-jar</code> command-line option of the
* <tt>java</tt> application launcher.
* The {@code Main-Class} attribute is used in conjunction
* with the {@code -jar} command-line option of the
* {@code java} application launcher.
*/
public static final Name MAIN_CLASS = new Name("Main-Class");
/**
* <code>Name</code> object for <code>Sealed</code> manifest attribute
* {@code Name} object for {@code Sealed} manifest attribute
* used for sealing.
* @see <a href="../../../../technotes/guides/jar/jar.html#sealing">
* Package Sealing</a>
@ -574,19 +574,19 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name SEALED = new Name("Sealed");
/**
* <code>Name</code> object for <code>Extension-List</code> manifest attribute
* {@code Name} object for {@code Extension-List} manifest attribute
* used for the extension mechanism that is no longer supported.
*/
public static final Name EXTENSION_LIST = new Name("Extension-List");
/**
* <code>Name</code> object for <code>Extension-Name</code> manifest attribute.
* {@code Name} object for {@code Extension-Name} manifest attribute.
* used for the extension mechanism that is no longer supported.
*/
public static final Name EXTENSION_NAME = new Name("Extension-Name");
/**
* <code>Name</code> object for <code>Extension-Installation</code> manifest attribute.
* {@code Name} object for {@code Extension-Installation} manifest attribute.
*
* @deprecated Extension mechanism is no longer supported.
*/
@ -594,25 +594,25 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name EXTENSION_INSTALLATION = new Name("Extension-Installation");
/**
* <code>Name</code> object for <code>Implementation-Title</code>
* {@code Name} object for {@code Implementation-Title}
* manifest attribute used for package versioning.
*/
public static final Name IMPLEMENTATION_TITLE = new Name("Implementation-Title");
/**
* <code>Name</code> object for <code>Implementation-Version</code>
* {@code Name} object for {@code Implementation-Version}
* manifest attribute used for package versioning.
*/
public static final Name IMPLEMENTATION_VERSION = new Name("Implementation-Version");
/**
* <code>Name</code> object for <code>Implementation-Vendor</code>
* {@code Name} object for {@code Implementation-Vendor}
* manifest attribute used for package versioning.
*/
public static final Name IMPLEMENTATION_VENDOR = new Name("Implementation-Vendor");
/**
* <code>Name</code> object for <code>Implementation-Vendor-Id</code>
* {@code Name} object for {@code Implementation-Vendor-Id}
* manifest attribute.
*
* @deprecated Extension mechanism is no longer supported.
@ -621,7 +621,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id");
/**
* <code>Name</code> object for <code>Implementation-URL</code>
* {@code Name} object for {@code Implementation-URL}
* manifest attribute.
*
* @deprecated Extension mechanism is no longer supported.
@ -630,19 +630,19 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name IMPLEMENTATION_URL = new Name("Implementation-URL");
/**
* <code>Name</code> object for <code>Specification-Title</code>
* {@code Name} object for {@code Specification-Title}
* manifest attribute used for package versioning.
*/
public static final Name SPECIFICATION_TITLE = new Name("Specification-Title");
/**
* <code>Name</code> object for <code>Specification-Version</code>
* {@code Name} object for {@code Specification-Version}
* manifest attribute used for package versioning.
*/
public static final Name SPECIFICATION_VERSION = new Name("Specification-Version");
/**
* <code>Name</code> object for <code>Specification-Vendor</code>
* {@code Name} object for {@code Specification-Vendor}
* manifest attribute used for package versioning.
*/
public static final Name SPECIFICATION_VENDOR = new Name("Specification-Vendor");

View File

@ -43,14 +43,14 @@ import sun.misc.SharedSecrets;
import sun.security.util.SignatureFileVerifier;
/**
* The <code>JarFile</code> class is used to read the contents of a jar file
* from any file that can be opened with <code>java.io.RandomAccessFile</code>.
* It extends the class <code>java.util.zip.ZipFile</code> with support
* for reading an optional <code>Manifest</code> entry. The
* <code>Manifest</code> can be used to specify meta-information about the
* The {@code JarFile} class is used to read the contents of a jar file
* from any file that can be opened with {@code java.io.RandomAccessFile}.
* It extends the class {@code java.util.zip.ZipFile} with support
* for reading an optional {@code Manifest} entry. The
* {@code Manifest} can be used to specify meta-information about the
* jar file and its entries.
*
* <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
* <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
@ -91,8 +91,8 @@ class JarFile extends ZipFile {
public static final String MANIFEST_NAME = "META-INF/MANIFEST.MF";
/**
* Creates a new <code>JarFile</code> to read from the specified
* file <code>name</code>. The <code>JarFile</code> will be verified if
* Creates a new {@code JarFile} to read from the specified
* file {@code name}. The {@code JarFile} will be verified if
* it is signed.
* @param name the name of the jar file to be opened for reading
* @throws IOException if an I/O error has occurred
@ -104,8 +104,8 @@ class JarFile extends ZipFile {
}
/**
* Creates a new <code>JarFile</code> to read from the specified
* file <code>name</code>.
* Creates a new {@code JarFile} to read from the specified
* file {@code name}.
* @param name the name of the jar file to be opened for reading
* @param verify whether or not to verify the jar file if
* it is signed.
@ -118,8 +118,8 @@ class JarFile extends ZipFile {
}
/**
* Creates a new <code>JarFile</code> to read from the specified
* <code>File</code> object. The <code>JarFile</code> will be verified if
* Creates a new {@code JarFile} to read from the specified
* {@code File} object. The {@code JarFile} will be verified if
* it is signed.
* @param file the jar file to be opened for reading
* @throws IOException if an I/O error has occurred
@ -132,8 +132,8 @@ class JarFile extends ZipFile {
/**
* Creates a new <code>JarFile</code> to read from the specified
* <code>File</code> object.
* Creates a new {@code JarFile} to read from the specified
* {@code File} object.
* @param file the jar file to be opened for reading
* @param verify whether or not to verify the jar file if
* it is signed.
@ -147,9 +147,9 @@ class JarFile extends ZipFile {
/**
* Creates a new <code>JarFile</code> to read from the specified
* <code>File</code> object in the specified mode. The mode argument
* must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
* Creates a new {@code JarFile} to read from the specified
* {@code File} object in the specified mode. The mode argument
* must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
* @param file the jar file to be opened for reading
* @param verify whether or not to verify the jar file if
@ -157,7 +157,7 @@ class JarFile extends ZipFile {
* @param mode the mode in which the file is to be opened
* @throws IOException if an I/O error has occurred
* @throws IllegalArgumentException
* if the <tt>mode</tt> argument is invalid
* if the {@code mode} argument is invalid
* @throws SecurityException if access to the file is denied
* by the SecurityManager
* @since 1.3
@ -168,9 +168,9 @@ class JarFile extends ZipFile {
}
/**
* Returns the jar file manifest, or <code>null</code> if none.
* Returns the jar file manifest, or {@code null} if none.
*
* @return the jar file manifest, or <code>null</code> if none
* @return the jar file manifest, or {@code null} if none
*
* @throws IllegalStateException
* may be thrown if the jar file has been closed
@ -207,12 +207,12 @@ class JarFile extends ZipFile {
private native String[] getMetaInfEntryNames();
/**
* Returns the <code>JarEntry</code> for the given entry name or
* <code>null</code> if not found.
* Returns the {@code JarEntry} for the given entry name or
* {@code null} if not found.
*
* @param name the jar file entry name
* @return the <code>JarEntry</code> for the given entry name or
* <code>null</code> if not found.
* @return the {@code JarEntry} for the given entry name or
* {@code null} if not found.
*
* @throws IllegalStateException
* may be thrown if the jar file has been closed
@ -224,12 +224,12 @@ class JarFile extends ZipFile {
}
/**
* Returns the <code>ZipEntry</code> for the given entry name or
* <code>null</code> if not found.
* Returns the {@code ZipEntry} for the given entry name or
* {@code null} if not found.
*
* @param name the jar file entry name
* @return the <code>ZipEntry</code> for the given entry name or
* <code>null</code> if not found
* @return the {@code ZipEntry} for the given entry name or
* {@code null} if not found
*
* @throws IllegalStateException
* may be thrown if the jar file has been closed

View File

@ -95,7 +95,7 @@ import java.io.IOException;
* the file encoded with Pack200 and further compressed with gzip. Please
* refer to the Java Deployment Guide for techniques and details.
* <p>
* Unless otherwise noted, passing a <tt>null</tt> argument to a constructor or
* Unless otherwise noted, passing a {@code null} argument to a constructor or
* method in this class will cause a {@link NullPointerException} to be thrown.
*
* @author John Rose
@ -109,7 +109,7 @@ public abstract class Pack200 {
/**
* Obtain new instance of a class that implements Packer.
* <ul>
* <li><p>If the system property <tt>java.util.jar.Pack200.Packer</tt>
* <li><p>If the system property {@code java.util.jar.Pack200.Packer}
* is defined, then the value is taken to be the fully-qualified name
* of a concrete implementation class, which must implement Packer.
* This class is loaded and instantiated. If this process fails
@ -135,7 +135,7 @@ public abstract class Pack200 {
/**
* Obtain new instance of a class that implements Unpacker.
* <ul>
* <li><p>If the system property <tt>java.util.jar.Pack200.Unpacker</tt>
* <li><p>If the system property {@code java.util.jar.Pack200.Unpacker}
* is defined, then the value is taken to be the fully-qualified
* name of a concrete implementation class, which must implement Unpacker.
* The class is loaded and instantiated. If this process fails
@ -220,7 +220,7 @@ public abstract class Pack200 {
* If the input JAR-files contains a 1.6 class file, then the pack file
* version will be set to 1.6.
* <p>
* Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
* Note: Unless otherwise noted, passing a {@code null} argument to a
* constructor or method in this class will cause a {@link NullPointerException}
* to be thrown.
*
@ -367,7 +367,7 @@ public abstract class Pack200 {
* {@link #STRIP}, and {@link #PASS}.
* <p>
* The string {@link #ERROR} means that the pack operation
* as a whole will fail, with an exception of type <code>IOException</code>.
* as a whole will fail, with an exception of type {@code IOException}.
* The string
* {@link #STRIP} means that the attribute will be dropped.
* The string
@ -391,7 +391,7 @@ public abstract class Pack200 {
* using the layout language specified in the JSR 200 specification.
* <p>
* For example, the effect of this option is built in:
* <code>pack.class.attribute.SourceFile=RUH</code>.
* {@code pack.class.attribute.SourceFile=RUH}.
* <p>
* The special strings {@link #ERROR}, {@link #STRIP}, and {@link #PASS} are
* also allowed, with the same meaning as {@link #UNKNOWN_ATTRIBUTE}.
@ -399,21 +399,21 @@ public abstract class Pack200 {
* refused, stripped, or passed bitwise (with no class compression).
* <p>
* Code like this might be used to support attributes for JCOV:
* <pre><code>
* <pre>{@code
* Map p = packer.properties();
* p.put(CODE_ATTRIBUTE_PFX+"CoverageTable", "NH[PHHII]");
* p.put(CODE_ATTRIBUTE_PFX+"CharacterRangeTable", "NH[PHPOHIIH]");
* p.put(CLASS_ATTRIBUTE_PFX+"SourceID", "RUH");
* p.put(CLASS_ATTRIBUTE_PFX+"CompilationID", "RUH");
* </code></pre>
* }</pre>
* <p>
* Code like this might be used to strip debugging attributes:
* <pre><code>
* <pre>{@code
* Map p = packer.properties();
* p.put(CODE_ATTRIBUTE_PFX+"LineNumberTable", STRIP);
* p.put(CODE_ATTRIBUTE_PFX+"LocalVariableTable", STRIP);
* p.put(CLASS_ATTRIBUTE_PFX+"SourceFile", STRIP);
* </code></pre>
* }</pre>
*/
String CLASS_ATTRIBUTE_PFX = "pack.class.attribute.";
@ -421,7 +421,7 @@ public abstract class Pack200 {
* When concatenated with a field attribute name,
* indicates the format of that attribute.
* For example, the effect of this option is built in:
* <code>pack.field.attribute.Deprecated=</code>.
* {@code pack.field.attribute.Deprecated=}.
* The special strings {@link #ERROR}, {@link #STRIP}, and
* {@link #PASS} are also allowed.
* @see #CLASS_ATTRIBUTE_PFX
@ -432,7 +432,7 @@ public abstract class Pack200 {
* When concatenated with a method attribute name,
* indicates the format of that attribute.
* For example, the effect of this option is built in:
* <code>pack.method.attribute.Exceptions=NH[RCH]</code>.
* {@code pack.method.attribute.Exceptions=NH[RCH]}.
* The special strings {@link #ERROR}, {@link #STRIP}, and {@link #PASS}
* are also allowed.
* @see #CLASS_ATTRIBUTE_PFX
@ -443,7 +443,7 @@ public abstract class Pack200 {
* When concatenated with a code attribute name,
* indicates the format of that attribute.
* For example, the effect of this option is built in:
* <code>pack.code.attribute.LocalVariableTable=NH[PHOHRUHRSHH]</code>.
* {@code pack.code.attribute.LocalVariableTable=NH[PHOHRUHRSHH]}.
* The special strings {@link #ERROR}, {@link #STRIP}, and {@link #PASS}
* are also allowed.
* @see #CLASS_ATTRIBUTE_PFX
@ -527,9 +527,9 @@ public abstract class Pack200 {
* <p>
* Implementation specific properties are prefixed with a
* package name associated with the implementor, beginning
* with <tt>com.</tt> or a similar prefix.
* All property names beginning with <tt>pack.</tt> and
* <tt>unpack.</tt> are reserved for use by this API.
* with {@code com.} or a similar prefix.
* All property names beginning with {@code pack.} and
* {@code unpack.} are reserved for use by this API.
* <p>
* Unknown properties may be ignored or rejected with an
* unspecified error, and invalid entries may cause an
@ -575,10 +575,10 @@ public abstract class Pack200 {
* using {@link #newUnpacker}.
* <p>
* Every JAR file produced by this engine will include the string
* "<tt>PACK200</tt>" as a zip file comment.
* "{@code PACK200}" as a zip file comment.
* This allows a deployer to detect if a JAR archive was packed and unpacked.
* <p>
* Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
* Note: Unless otherwise noted, passing a {@code null} argument to a
* constructor or method in this class will cause a {@link NullPointerException}
* to be thrown.
* <p>
@ -641,9 +641,9 @@ public abstract class Pack200 {
* <p>
* Implementation specific properties are prefixed with a
* package name associated with the implementor, beginning
* with <tt>com.</tt> or a similar prefix.
* All property names beginning with <tt>pack.</tt> and
* <tt>unpack.</tt> are reserved for use by this API.
* with {@code com.} or a similar prefix.
* All property names beginning with {@code pack.} and
* {@code unpack.} are reserved for use by this API.
* <p>
* Unknown properties may be ignored or rejected with an
* unspecified error, and invalid entries may cause an

View File

@ -63,7 +63,7 @@ import java.util.stream.StreamSupport;
*
* <p> A matcher finds matches in a subset of its input called the
* <i>region</i>. By default, the region contains all of the matcher's input.
* The region can be modified via the{@link #region region} method and queried
* The region can be modified via the {@link #region region} method and queried
* via the {@link #regionStart regionStart} and {@link #regionEnd regionEnd}
* methods. The way that the region boundaries interact with some pattern
* constructs can be changed. See {@link #useAnchoringBounds
@ -1639,15 +1639,15 @@ public final class Matcher implements MatchResult {
*/
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("java.util.regex.Matcher");
sb.append("[pattern=" + pattern());
sb.append(" region=");
sb.append(regionStart() + "," + regionEnd());
sb.append(" lastmatch=");
sb.append("java.util.regex.Matcher")
.append("[pattern=").append(pattern())
.append(" region=")
.append(regionStart()).append(',').append(regionEnd())
.append(" lastmatch=");
if ((first >= 0) && (group() != null)) {
sb.append(group());
}
sb.append("]");
sb.append(']');
return sb.toString();
}

View File

@ -565,7 +565,7 @@ import java.util.stream.StreamSupport;
* <p>
* <b><a name="usc">Scripts</a></b> are specified either with the prefix {@code Is}, as in
* {@code IsHiragana}, or by using the {@code script} keyword (or its short
* form {@code sc})as in {@code script=Hiragana} or {@code sc=Hiragana}.
* form {@code sc}) as in {@code script=Hiragana} or {@code sc=Hiragana}.
* <p>
* The script names supported by <code>Pattern</code> are the valid script names
* accepted and defined by
@ -1299,18 +1299,22 @@ public final class Pattern
if (slashEIndex == -1)
return "\\Q" + s + "\\E";
StringBuilder sb = new StringBuilder(s.length() * 2);
int lenHint = s.length();
lenHint = (lenHint < Integer.MAX_VALUE - 8 - lenHint) ?
(lenHint << 1) : (Integer.MAX_VALUE - 8);
StringBuilder sb = new StringBuilder(lenHint);
sb.append("\\Q");
slashEIndex = 0;
int current = 0;
while ((slashEIndex = s.indexOf("\\E", current)) != -1) {
sb.append(s.substring(current, slashEIndex));
do {
sb.append(s, current, slashEIndex)
.append("\\E\\\\E\\Q");
current = slashEIndex + 2;
sb.append("\\E\\\\E\\Q");
}
sb.append(s.substring(current, s.length()));
sb.append("\\E");
return sb.toString();
} while ((slashEIndex = s.indexOf("\\E", current)) != -1);
return sb.append(s, current, s.length())
.append("\\E")
.toString();
}
/**
@ -1367,14 +1371,16 @@ public final class Pattern
}
/**
* The pattern is converted to normalizedD form and then a pure group
* is constructed to match canonical equivalences of the characters.
* The pattern is converted to normalized form ({@linkplain
* java.text.Normalizer.Form.NFD NFD}, canonical decomposition)
* and then a pure group is constructed to match canonical
* equivalences of the characters.
*/
private void normalize() {
boolean inCharClass = false;
int lastCodePoint = -1;
// Convert pattern into normalizedD form
// Convert pattern into normalized form
normalizedPattern = Normalizer.normalize(pattern, Normalizer.Form.NFD);
patternLength = normalizedPattern.length();

View File

@ -223,7 +223,7 @@ public interface Collector<T, A, R> {
* Perform the final transformation from the intermediate accumulation type
* {@code A} to the final result type {@code R}.
*
* <p>If the characteristic {@code IDENTITY_TRANSFORM} is
* <p>If the characteristic {@code IDENTITY_FINISH} is
* set, this function may be presumed to be an identity transform with an
* unchecked cast from {@code A} to {@code R}.
*

View File

@ -293,7 +293,7 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
* takes all elements (the result is the same is the input), or if no
* takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@ -329,6 +329,7 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default DoubleStream takeWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
@ -361,7 +362,7 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
* result is the same is the input).
* result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@ -395,6 +396,7 @@ public interface DoubleStream extends BaseStream<Double, DoubleStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default DoubleStream dropWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);

View File

@ -291,7 +291,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
* takes all elements (the result is the same is the input), or if no
* takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@ -326,6 +326,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default IntStream takeWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
@ -358,7 +359,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
* result is the same is the input).
* result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@ -391,6 +392,7 @@ public interface IntStream extends BaseStream<Integer, IntStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default IntStream dropWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);

View File

@ -291,7 +291,7 @@ public interface LongStream extends BaseStream<Long, LongStream> {
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
* takes all elements (the result is the same is the input), or if no
* takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@ -327,6 +327,7 @@ public interface LongStream extends BaseStream<Long, LongStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default LongStream takeWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);
@ -359,7 +360,7 @@ public interface LongStream extends BaseStream<Long, LongStream> {
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
* result is the same is the input).
* result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@ -393,6 +394,7 @@ public interface LongStream extends BaseStream<Long, LongStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default LongStream dropWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);

View File

@ -138,7 +138,7 @@ final class SliceOps {
skip, limit, size);
}
else {
// @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n)
// @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE).filter(i -> true).limit(n)
// regardless of the value of n
// Need to adjust the target size of splitting for the
// SliceTask from say (size / k) to say min(size / k, 1 << 14)

View File

@ -498,7 +498,7 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
* takes all elements (the result is the same is the input), or if no
* takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@ -533,6 +533,7 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default Stream<T> takeWhile(Predicate<? super T> predicate) {
Objects.requireNonNull(predicate);
@ -565,7 +566,7 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
* result is the same is the input).
* result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@ -598,6 +599,7 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
* @since 1.9
*/
default Stream<T> dropWhile(Predicate<? super T> predicate) {
Objects.requireNonNull(predicate);
@ -1230,6 +1232,9 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
* Accessing an element of a deeply concatenated stream can result in deep
* call chains, or even {@code StackOverflowError}.
*
* <p>Subsequent changes to the sequential/parallel execution mode of the
* returned stream are not guaranteed to be propagated to the input streams.
*
* @param <T> The type of stream elements
* @param a the first stream
* @param b the second stream

View File

@ -156,10 +156,9 @@ final class Streams {
* than a balanced tree at the expense of a higher-depth for the right
* side of the range.
*
* <p>This is optimized for cases such as IntStream.ints() that is
* implemented as range of 0 to Integer.MAX_VALUE but is likely to be
* augmented with a limit operation that limits the number of elements
* to a count lower than this threshold.
* <p>This is optimized for cases such as IntStream.range(0, Integer.MAX_VALUE)
* that is likely to be augmented with a limit operation that limits the
* number of elements to a count lower than this threshold.
*/
private static final int BALANCED_SPLIT_THRESHOLD = 1 << 24;
@ -280,10 +279,9 @@ final class Streams {
* than a balanced tree at the expense of a higher-depth for the right
* side of the range.
*
* <p>This is optimized for cases such as LongStream.longs() that is
* implemented as range of 0 to Long.MAX_VALUE but is likely to be
* augmented with a limit operation that limits the number of elements
* to a count lower than this threshold.
* <p>This is optimized for cases such as LongStream.range(0, Long.MAX_VALUE)
* that is likely to be augmented with a limit operation that limits the
* number of elements to a count lower than this threshold.
*/
private static final long BALANCED_SPLIT_THRESHOLD = 1 << 24;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. 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
@ -159,7 +159,7 @@
* is a necessary, but not sufficient, condition for the processing of an infinite
* stream to terminate normally in finite time.
*
* <h3>Parallelism</h3>
* <h3><a name="Parallelism">Parallelism</a></h3>
*
* <p>Processing elements with an explicit {@code for-}loop is inherently serial.
* Streams facilitate parallel execution by reframing the computation as a pipeline of
@ -184,15 +184,15 @@
*
* <p>The only difference between the serial and parallel versions of this
* example is the creation of the initial stream, using "{@code parallelStream()}"
* instead of "{@code stream()}". When the terminal operation is initiated,
* the stream pipeline is executed sequentially or in parallel depending on the
* orientation of the stream on which it is invoked. Whether a stream will execute in serial or
* parallel can be determined with the {@code isParallel()} method, and the
* orientation of a stream can be modified with the
* instead of "{@code stream()}". The stream pipeline is executed sequentially or
* in parallel depending on the mode of the stream on which the terminal operation
* is invoked. The sequential or parallel mode of a stream can be determined with the
* {@link java.util.stream.BaseStream#isParallel()} method, and the
* stream's mode can be modified with the
* {@link java.util.stream.BaseStream#sequential()} and
* {@link java.util.stream.BaseStream#parallel()} operations. When the terminal
* operation is initiated, the stream pipeline is executed sequentially or in
* parallel depending on the mode of the stream on which it is invoked.
* {@link java.util.stream.BaseStream#parallel()} operations.
* The most recent sequential or parallel mode setting applies to the
* execution of the entire stream pipeline.
*
* <p>Except for operations identified as explicitly nondeterministic, such
* as {@code findAny()}, whether a stream executes sequentially or in parallel
@ -280,7 +280,7 @@
* parameters to stream operations entirely; there is usually a way to
* restructure the stream pipeline to avoid statefulness.
*
* <h3>Side-effects</h3>
* <h3><a name="SideEffects">Side-effects</a></h3>
*
* Side-effects in behavioral parameters to stream operations are, in general,
* discouraged, as they can often lead to unwitting violations of the

View File

@ -34,8 +34,8 @@ package java.util.zip;
* package description</a>.
*
* <p>The following code fragment demonstrates a trivial compression
* and decompression of a string using <tt>Deflater</tt> and
* <tt>Inflater</tt>.
* and decompression of a string using {@code Deflater} and
* {@code Inflater}.
*
* <blockquote><pre>
* try {

View File

@ -34,8 +34,8 @@ package java.util.zip;
* package description</a>.
*
* <p>The following code fragment demonstrates a trivial compression
* and decompression of a string using <tt>Deflater</tt> and
* <tt>Inflater</tt>.
* and decompression of a string using {@code Deflater} and
* {@code Inflater}.
*
* <blockquote><pre>
* try {

View File

@ -50,7 +50,7 @@ import static java.util.zip.ZipConstants64.*;
/**
* This class is used to read entries from a zip file.
*
* <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
* <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
@ -76,7 +76,7 @@ class ZipFile implements ZipConstants, Closeable {
* Mode flag to open a zip file and mark it for deletion. The file will be
* deleted some time between the moment that it is opened and the moment
* that it is closed, but its contents will remain accessible via the
* <tt>ZipFile</tt> object until either the close method is invoked or the
* {@code ZipFile} object until either the close method is invoked or the
* virtual machine exits.
*/
public static final int OPEN_DELETE = 0x4;
@ -101,8 +101,8 @@ class ZipFile implements ZipConstants, Closeable {
/**
* Opens a zip file for reading.
*
* <p>First, if there is a security manager, its <code>checkRead</code>
* method is called with the <code>name</code> argument as its argument
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument
* to ensure the read is allowed.
*
* <p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
@ -112,7 +112,7 @@ class ZipFile implements ZipConstants, Closeable {
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException if a security manager exists and its
* <code>checkRead</code> method doesn't allow read access to the file.
* {@code checkRead} method doesn't allow read access to the file.
*
* @see SecurityManager#checkRead(java.lang.String)
*/
@ -121,12 +121,12 @@ class ZipFile implements ZipConstants, Closeable {
}
/**
* Opens a new <code>ZipFile</code> to read from the specified
* <code>File</code> object in the specified mode. The mode argument
* must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
* Opens a new {@code ZipFile} to read from the specified
* {@code File} object in the specified mode. The mode argument
* must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
* <p>First, if there is a security manager, its <code>checkRead</code>
* method is called with the <code>name</code> argument as its argument to
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument to
* ensure the read is allowed.
*
* <p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
@ -137,11 +137,11 @@ class ZipFile implements ZipConstants, Closeable {
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException if a security manager exists and
* its <code>checkRead</code> method
* its {@code checkRead} method
* doesn't allow read access to the file,
* or its <code>checkDelete</code> method doesn't allow deleting
* the file when the <tt>OPEN_DELETE</tt> flag is set.
* @throws IllegalArgumentException if the <tt>mode</tt> argument is invalid
* or its {@code checkDelete} method doesn't allow deleting
* the file when the {@code OPEN_DELETE} flag is set.
* @throws IllegalArgumentException if the {@code mode} argument is invalid
* @see SecurityManager#checkRead(java.lang.String)
* @since 1.3
*/
@ -166,12 +166,12 @@ class ZipFile implements ZipConstants, Closeable {
private ZipCoder zc;
/**
* Opens a new <code>ZipFile</code> to read from the specified
* <code>File</code> object in the specified mode. The mode argument
* must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
* Opens a new {@code ZipFile} to read from the specified
* {@code File} object in the specified mode. The mode argument
* must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
* <p>First, if there is a security manager, its <code>checkRead</code>
* method is called with the <code>name</code> argument as its argument to
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument to
* ensure the read is allowed.
*
* @param file the ZIP file to be opened for reading
@ -186,12 +186,12 @@ class ZipFile implements ZipConstants, Closeable {
* @throws IOException if an I/O error has occurred
*
* @throws SecurityException
* if a security manager exists and its <code>checkRead</code>
* if a security manager exists and its {@code checkRead}
* method doesn't allow read access to the file,or its
* <code>checkDelete</code> method doesn't allow deleting the
* file when the <tt>OPEN_DELETE</tt> flag is set
* {@code checkDelete} method doesn't allow deleting the
* file when the {@code OPEN_DELETE} flag is set
*
* @throws IllegalArgumentException if the <tt>mode</tt> argument is invalid
* @throws IllegalArgumentException if the {@code mode} argument is invalid
*
* @see SecurityManager#checkRead(java.lang.String)
*
@ -227,8 +227,8 @@ class ZipFile implements ZipConstants, Closeable {
/**
* Opens a zip file for reading.
*
* <p>First, if there is a security manager, its <code>checkRead</code>
* method is called with the <code>name</code> argument as its argument
* <p>First, if there is a security manager, its {@code checkRead}
* method is called with the {@code name} argument as its argument
* to ensure the read is allowed.
*
* @param name the name of the zip file
@ -241,7 +241,7 @@ class ZipFile implements ZipConstants, Closeable {
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException
* if a security manager exists and its <code>checkRead</code>
* if a security manager exists and its {@code checkRead}
* method doesn't allow read access to the file
*
* @see SecurityManager#checkRead(java.lang.String)
@ -654,8 +654,8 @@ class ZipFile implements ZipConstants, Closeable {
*
* <p>
* Since the time when GC would invoke this method is undetermined,
* it is strongly recommended that applications invoke the <code>close</code>
* method as soon they have finished accessing this <code>ZipFile</code>.
* it is strongly recommended that applications invoke the {@code close}
* method as soon they have finished accessing this {@code ZipFile}.
* This will prevent holding up system resources for an undetermined
* length of time.
*

View File

@ -115,4 +115,45 @@ public abstract class ExtendedSSLSession implements SSLSession {
public List<SNIServerName> getRequestedServerNames() {
throw new UnsupportedOperationException();
}
/**
* Returns a {@link List} containing DER-encoded OCSP responses
* (using the ASN.1 type OCSPResponse defined in RFC 6960) for
* the client to verify status of the server's certificate during
* handshaking.
*
* <P>
* This method only applies to certificate-based server
* authentication. An {@link X509ExtendedTrustManager} will use the
* returned value for server certificate validation.
*
* @implSpec This method throws UnsupportedOperationException by default.
* Classes derived from ExtendedSSLSession must implement
* this method.
*
* @return a non-null unmodifiable list of byte arrays, each entry
* containing a DER-encoded OCSP response (using the
* ASN.1 type OCSPResponse defined in RFC 6960). The order
* of the responses must match the order of the certificates
* presented by the server in its Certificate message (See
* {@link SSLSession#getLocalCertificates()} for server mode,
* and {@link SSLSession#getPeerCertificates()} for client mode).
* It is possible that fewer response entries may be returned than
* the number of presented certificates. If an entry in the list
* is a zero-length byte array, it should be treated by the
* caller as if the OCSP entry for the corresponding certificate
* is missing. The returned list may be empty if no OCSP responses
* were presented during handshaking or if OCSP stapling is not
* supported by either endpoint for this handshake.
*
* @throws UnsupportedOperationException if the underlying provider
* does not implement the operation
*
* @see X509ExtendedTrustManager
*
* @since 9
*/
public List<byte[]> getStatusResponses() {
throw new UnsupportedOperationException();
}
}

View File

@ -42,14 +42,13 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import static sun.security.provider.certpath.OCSPResponse.*;
import sun.security.action.GetIntegerAction;
import sun.security.util.Debug;
import sun.security.util.ObjectIdentifier;
import sun.security.x509.AccessDescription;
import sun.security.x509.AuthorityInfoAccessExtension;
import sun.security.x509.GeneralName;
import sun.security.x509.GeneralNameInterface;
import sun.security.x509.PKIXExtensions;
import sun.security.x509.URIName;
import sun.security.x509.X509CertImpl;
@ -65,9 +64,6 @@ import sun.security.x509.X509CertImpl;
*/
public final class OCSP {
static final ObjectIdentifier NONCE_EXTENSION_OID =
ObjectIdentifier.newInternal(new int[]{ 1, 3, 6, 1, 5, 5, 7, 48, 1, 2});
private static final Debug debug = Debug.getInstance("certpath");
private static final int DEFAULT_CONNECT_TIMEOUT = 15000;
@ -184,12 +180,15 @@ public final class OCSP {
/**
* Checks the revocation status of a list of certificates using OCSP.
*
* @param certs the CertIds to be checked
* @param certIds the CertIds to be checked
* @param responderURI the URI of the OCSP responder
* @param issuerCert the issuer's certificate
* @param responderCert the OCSP responder's certificate
* @param date the time the validity of the OCSP responder's certificate
* should be checked against. If null, the current time is used.
* @param extensions zero or more OCSP extensions to be included in the
* request. If no extensions are requested, an empty {@code List} must
* be used. A {@code null} value is not allowed.
* @return the OCSPResponse
* @throws IOException if there is an exception connecting to or
* communicating with the OCSP responder
@ -202,19 +201,54 @@ public final class OCSP {
List<Extension> extensions)
throws IOException, CertPathValidatorException
{
byte[] bytes = null;
OCSPRequest request = null;
try {
request = new OCSPRequest(certIds, extensions);
bytes = request.encodeBytes();
} catch (IOException ioe) {
throw new CertPathValidatorException
("Exception while encoding OCSPRequest", ioe);
byte[] nonce = null;
for (Extension ext : extensions) {
if (ext.getId().equals(PKIXExtensions.OCSPNonce_Id.toString())) {
nonce = ext.getValue();
}
}
OCSPResponse ocspResponse = null;
try {
byte[] response = getOCSPBytes(certIds, responderURI, extensions);
ocspResponse = new OCSPResponse(response);
// verify the response
ocspResponse.verify(certIds, issuerCert, responderCert, date,
nonce);
} catch (IOException ioe) {
throw new CertPathValidatorException(
"Unable to determine revocation status due to network error",
ioe, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
}
return ocspResponse;
}
/**
* Send an OCSP request, then read and return the OCSP response bytes.
*
* @param certIds the CertIds to be checked
* @param responderURI the URI of the OCSP responder
* @param extensions zero or more OCSP extensions to be included in the
* request. If no extensions are requested, an empty {@code List} must
* be used. A {@code null} value is not allowed.
*
* @return the OCSP response bytes
*
* @throws IOException if there is an exception connecting to or
* communicating with the OCSP responder
*/
public static byte[] getOCSPBytes(List<CertId> certIds, URI responderURI,
List<Extension> extensions) throws IOException {
OCSPRequest request = new OCSPRequest(certIds, extensions);
byte[] bytes = request.encodeBytes();
InputStream in = null;
OutputStream out = null;
byte[] response = null;
try {
URL url = responderURI.toURL();
if (debug != null) {
@ -257,10 +291,6 @@ public final class OCSP {
}
}
response = Arrays.copyOf(response, total);
} catch (IOException ioe) {
throw new CertPathValidatorException(
"Unable to determine revocation status due to network error",
ioe, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
} finally {
if (in != null) {
try {
@ -277,20 +307,7 @@ public final class OCSP {
}
}
}
OCSPResponse ocspResponse = null;
try {
ocspResponse = new OCSPResponse(response);
} catch (IOException ioe) {
// response decoding exception
throw new CertPathValidatorException(ioe);
}
// verify the response
ocspResponse.verify(certIds, issuerCert, responderCert, date,
request.getNonce());
return ocspResponse;
return response;
}
/**

View File

@ -0,0 +1,294 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.provider.certpath;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Enumeration;
import java.security.SecureRandom;
import sun.security.x509.AttributeNameEnumeration;
import sun.security.x509.CertAttrSet;
import sun.security.x509.Extension;
import sun.security.x509.PKIXExtensions;
import sun.security.util.*;
/**
* Represent the OCSP Nonce Extension.
* This extension, if present, provides a nonce value in OCSP requests
* and responses. This will cryptographically bind requests and responses
* and help to prevent replay attacks (see RFC 6960, section 4.4.1).
*
* @see Extension
* @see CertAttrSet
*/
public class OCSPNonceExtension extends Extension
implements CertAttrSet<String> {
/**
* Attribute name.
*/
public static final String NAME = "OCSPNonce";
public static final String NONCE = "nonce";
private byte[] nonceData = null;
private String extensionName;
/**
* Encode this extension value to DER and assign it to the
* {@code extensionName} data member.
*
* @throws IOException if any errors occur during DER encoding
*/
private void encodeInternal() throws IOException {
if (nonceData == null) {
this.extensionValue = null;
return;
}
DerOutputStream os = new DerOutputStream();
os.putOctetString(this.nonceData);
this.extensionValue = os.toByteArray();
}
/**
* Create a {@code OCSPNonceExtension} by providing the nonce length.
* The criticality is set to false. The random bytes will be generated
* using the SUN provider.
*
* @param length the number of random bytes composing the nonce
*
* @throws IOException if any errors happen during encoding of the
* extension.
*/
public OCSPNonceExtension(int length) throws IOException {
this(PKIXExtensions.OCSPNonce_Id, false, length, NAME);
}
/**
* Creates the extension (also called by the subclass).
*
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
* extension
* @param isCritical a boolean flag indicating if the criticality bit
* is to be set for this extension
* @param length the length of the nonce in bytes
* @param extensionName the name of the extension
*
* @throws IOException if any errors happen during encoding of the
* extension.
*/
protected OCSPNonceExtension(ObjectIdentifier extensionId,
boolean isCritical, int length, String extensionName)
throws IOException {
SecureRandom rng = new SecureRandom();
this.nonceData = new byte[length];
rng.nextBytes(nonceData);
this.extensionId = extensionId;
this.critical = isCritical;
this.extensionName = extensionName;
encodeInternal();
}
/**
* Create the extension using the provided criticality bit setting and
* DER encoding.
*
* @param critical true if the extension is to be treated as critical.
* @param value an array of DER encoded bytes of the extnValue for the
* extension. It must not include the encapsulating OCTET STRING
* tag and length. For an {@code OCSPNonceExtension} the data value
* should be a simple OCTET STRING containing random bytes
* (see RFC 6960, section 4.4.1).
*
* @throws ClassCastException if value is not an array of bytes
* @throws IOException if any errors happen during encoding of the
* extension
*/
public OCSPNonceExtension(Boolean critical, Object value)
throws IOException {
this(PKIXExtensions.OCSPNonce_Id, critical, value, NAME);
}
/**
* Creates the extension (also called by the subclass).
*
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
* extension
* @param critical a boolean flag indicating if the criticality bit
* is to be set for this extension
* @param value an array of DER encoded bytes of the extnValue for the
* extension. It must not include the encapsulating OCTET STRING
* tag and length. For an {@code OCSPNonceExtension} the data value
* should be a simple OCTET STRING containing random bytes
* (see RFC 6960, section 4.4.1).
* @param extensionName the name of the extension
*
* @throws ClassCastException if value is not an array of bytes
* @throws IOException if any errors happen during encoding of the
* extension
*/
protected OCSPNonceExtension(ObjectIdentifier extensionId,
Boolean critical, Object value, String extensionName)
throws IOException {
this.extensionId = extensionId;
this.critical = critical;
this.extensionValue = (byte[]) value;
DerValue val = new DerValue(this.extensionValue);
this.nonceData = val.getOctetString();
this.extensionName = extensionName;
}
/**
* Set the attribute value.
*
* @param name the name of the attribute.
* @param obj an array of nonce bytes for the extension. It must not
* contain any DER tags or length.
*
* @throws IOException if an unsupported name is provided or the supplied
* {@code obj} is not a byte array
*/
@Override
public void set(String name, Object obj) throws IOException {
if (name.equalsIgnoreCase(NONCE)) {
if (!(obj instanceof byte[])) {
throw new IOException("Attribute must be of type byte[].");
}
nonceData = (byte[])obj;
} else {
throw new IOException("Attribute name not recognized by"
+ " CertAttrSet:" + extensionName + ".");
}
encodeInternal();
}
/**
* Get the attribute value.
*
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
* is currently supported.
*
* @return an array of bytes that are the nonce data. It will not contain
* any DER tags or length, only the random nonce bytes.
*
* @throws IOException if an unsupported name is provided.
*/
@Override
public Object get(String name) throws IOException {
if (name.equalsIgnoreCase(NONCE)) {
return nonceData;
} else {
throw new IOException("Attribute name not recognized by"
+ " CertAttrSet:" + extensionName + ".");
}
}
/**
* Delete the attribute value.
*
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
* is currently supported.
*
* @throws IOException if an unsupported name is provided or an error
* occurs during re-encoding of the extension.
*/
@Override
public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(NONCE)) {
nonceData = null;
} else {
throw new IOException("Attribute name not recognized by"
+ " CertAttrSet:" + extensionName + ".");
}
encodeInternal();
}
/**
* Returns a printable representation of the {@code OCSPNonceExtension}.
*/
@Override
public String toString() {
String s = super.toString() + extensionName + ": " +
((nonceData == null) ? "" : Debug.toString(nonceData))
+ "\n";
return (s);
}
/**
* Write the extension to an {@code OutputStream}
*
* @param out the {@code OutputStream} to write the extension to.
*
* @throws IOException on encoding errors.
*/
@Override
public void encode(OutputStream out) throws IOException {
encode(out, PKIXExtensions.OCSPNonce_Id, this.critical);
}
/**
* Write the extension to the DerOutputStream.
*
* @param out the {@code OutputStream} to write the extension to.
* @param extensionId the {@code ObjectIdentifier} used for this extension
* @param isCritical a flag indicating if the criticality bit is set for
* this extension.
*
* @throws IOException on encoding errors.
*/
protected void encode(OutputStream out, ObjectIdentifier extensionId,
boolean isCritical) throws IOException {
DerOutputStream tmp = new DerOutputStream();
if (this.extensionValue == null) {
this.extensionId = extensionId;
this.critical = isCritical;
encodeInternal();
}
super.encode(tmp);
out.write(tmp.toByteArray());
}
/**
* Return an enumeration of names of attributes existing within this
* attribute.
*/
@Override
public Enumeration<String> getElements() {
AttributeNameEnumeration elements = new AttributeNameEnumeration();
elements.addElement(NONCE);
return (elements.elements());
}
/**
* Return the name of this attribute.
*/
@Override
public String getName() {
return (extensionName);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. 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
@ -32,10 +32,11 @@ import java.util.List;
import sun.misc.HexDumpEncoder;
import sun.security.util.*;
import sun.security.x509.PKIXExtensions;
/**
* This class can be used to generate an OCSP request and send it over
* an outputstream. Currently we do not support signing requests
* an output stream. Currently we do not support signing requests.
* The OCSP Request is specified in RFC 2560 and
* the ASN.1 definition is as follows:
* <pre>
@ -118,7 +119,8 @@ class OCSPRequest {
DerOutputStream extOut = new DerOutputStream();
for (Extension ext : extensions) {
ext.encode(extOut);
if (ext.getId().equals(OCSP.NONCE_EXTENSION_OID.toString())) {
if (ext.getId().equals(
PKIXExtensions.OCSPNonce_Id.toString())) {
nonce = ext.getValue();
}
}

View File

@ -41,6 +41,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.security.auth.x500.X500Principal;
import sun.misc.HexDumpEncoder;
@ -129,7 +130,7 @@ public final class OCSPResponse {
SIG_REQUIRED, // Must sign the request
UNAUTHORIZED // Request unauthorized
};
private static ResponseStatus[] rsvalues = ResponseStatus.values();
private static final ResponseStatus[] rsvalues = ResponseStatus.values();
private static final Debug debug = Debug.getInstance("certpath");
private static final boolean dump = debug != null && Debug.isOn("ocsp");
@ -173,7 +174,7 @@ public final class OCSPResponse {
}
// an array of all of the CRLReasons (used in SingleResponse)
private static CRLReason[] values = CRLReason.values();
private static final CRLReason[] values = CRLReason.values();
private final ResponseStatus responseStatus;
private final Map<CertId, SingleResponse> singleResponseMap;
@ -183,13 +184,16 @@ public final class OCSPResponse {
private final byte[] responseNonce;
private List<X509CertImpl> certs;
private X509CertImpl signerCert = null;
private X500Principal responderName = null;
private KeyIdentifier responderKeyId = null;
private final ResponderId respId;
private Date producedAtDate = null;
private final Map<String, java.security.cert.Extension> responseExtensions;
/*
* Create an OCSP response from its ASN.1 DER encoding.
*
* @param bytes The DER-encoded bytes for an OCSP response
*/
OCSPResponse(byte[] bytes) throws IOException {
public OCSPResponse(byte[] bytes) throws IOException {
if (dump) {
HexDumpEncoder hexEnc = new HexDumpEncoder();
debug.println("OCSPResponse bytes...\n\n" +
@ -221,6 +225,8 @@ public final class OCSPResponse {
signature = null;
tbsResponseData = null;
responseNonce = null;
responseExtensions = Collections.emptyMap();
respId = null;
return;
}
@ -239,7 +245,7 @@ public final class OCSPResponse {
// responseType
derIn = tmp.data;
ObjectIdentifier responseType = derIn.getOID();
if (responseType.equals(OCSP_BASIC_RESPONSE_OID)) {
if (responseType.equals((Object)OCSP_BASIC_RESPONSE_OID)) {
if (debug != null) {
debug.println("OCSP response type: basic");
}
@ -289,27 +295,15 @@ public final class OCSPResponse {
}
// responderID
short tag = (byte)(seq.tag & 0x1f);
if (tag == NAME_TAG) {
responderName = new X500Principal(seq.getData().toByteArray());
if (debug != null) {
debug.println("Responder's name: " + responderName);
}
} else if (tag == KEY_TAG) {
responderKeyId = new KeyIdentifier(seq.getData().getOctetString());
if (debug != null) {
debug.println("Responder's key ID: " +
Debug.toString(responderKeyId.getIdentifier()));
}
} else {
throw new IOException("Bad encoding in responderID element of " +
"OCSP response: expected ASN.1 context specific tag 0 or 1");
respId = new ResponderId(seq.toByteArray());
if (debug != null) {
debug.println("Responder ID: " + respId);
}
// producedAt
seq = seqDerIn.getDerValue();
producedAtDate = seq.getGeneralizedTime();
if (debug != null) {
Date producedAtDate = seq.getGeneralizedTime();
debug.println("OCSP response produced at: " + producedAtDate);
}
@ -320,36 +314,29 @@ public final class OCSPResponse {
debug.println("OCSP number of SingleResponses: "
+ singleResponseDer.length);
}
for (int i = 0; i < singleResponseDer.length; i++) {
SingleResponse singleResponse =
new SingleResponse(singleResponseDer[i]);
for (DerValue srDer : singleResponseDer) {
SingleResponse singleResponse = new SingleResponse(srDer);
singleResponseMap.put(singleResponse.getCertId(), singleResponse);
}
// responseExtensions
byte[] nonce = null;
Map<String, java.security.cert.Extension> tmpExtMap = new HashMap<>();
if (seqDerIn.available() > 0) {
seq = seqDerIn.getDerValue();
if (seq.isContextSpecific((byte)1)) {
DerValue[] responseExtDer = seq.data.getSequence(3);
for (int i = 0; i < responseExtDer.length; i++) {
Extension ext = new Extension(responseExtDer[i]);
if (debug != null) {
debug.println("OCSP extension: " + ext);
}
// Only the NONCE extension is recognized
if (ext.getExtensionId().equals(OCSP.NONCE_EXTENSION_OID))
{
nonce = ext.getExtensionValue();
} else if (ext.isCritical()) {
throw new IOException(
"Unsupported OCSP critical extension: " +
ext.getExtensionId());
}
}
tmpExtMap = parseExtensions(seq);
}
}
responseNonce = nonce;
responseExtensions = tmpExtMap;
// Attach the nonce value if found in the extension map
Extension nonceExt = (Extension)tmpExtMap.get(
PKIXExtensions.OCSPNonce_Id.toString());
responseNonce = (nonceExt != null) ?
nonceExt.getExtensionValue() : null;
if (debug != null && responseNonce != null) {
debug.println("Response nonce: " + Arrays.toString(responseNonce));
}
// signatureAlgorithmId
sigAlgId = AlgorithmId.parse(seqTmp[1]);
@ -436,20 +423,22 @@ public final class OCSPResponse {
"Invalid issuer or trusted responder certificate", ce);
}
if (responderName != null) {
if (respId.getType() == ResponderId.Type.BY_NAME) {
X500Principal rName = respId.getResponderName();
for (X509CertImpl cert : certs) {
if (cert.getSubjectX500Principal().equals(responderName)) {
if (cert.getSubjectX500Principal().equals(rName)) {
signerCert = cert;
break;
}
}
} else if (responderKeyId != null) {
} else if (respId.getType() == ResponderId.Type.BY_KEY) {
KeyIdentifier ridKeyId = respId.getKeyIdentifier();
for (X509CertImpl cert : certs) {
// Match responder's key identifier against the cert's SKID
// This will match if the SKID is encoded using the 160-bit
// SHA-1 hash method as defined in RFC 5280.
KeyIdentifier certKeyId = cert.getSubjectKeyId();
if (certKeyId != null && responderKeyId.equals(certKeyId)) {
if (certKeyId != null && ridKeyId.equals(certKeyId)) {
signerCert = cert;
break;
} else {
@ -463,7 +452,7 @@ public final class OCSPResponse {
} catch (IOException e) {
// ignore
}
if (responderKeyId.equals(certKeyId)) {
if (ridKeyId.equals(certKeyId)) {
signerCert = cert;
break;
}
@ -592,7 +581,6 @@ public final class OCSPResponse {
}
// Check freshness of OCSPResponse
long now = (date == null) ? System.currentTimeMillis() : date.getTime();
Date nowPlusSkew = new Date(now + MAX_CLOCK_SKEW);
Date nowMinusSkew = new Date(now - MAX_CLOCK_SKEW);
@ -603,16 +591,16 @@ public final class OCSPResponse {
until = " until " + sr.nextUpdate;
}
debug.println("OCSP response validity interval is from " +
sr.thisUpdate + until);
sr.thisUpdate + until);
debug.println("Checking validity of OCSP response on: " +
new Date(now));
new Date(now));
}
// Check that the test date is within the validity interval:
// [ thisUpdate - MAX_CLOCK_SKEW,
// MAX(thisUpdate, nextUpdate) + MAX_CLOCK_SKEW ]
if (nowPlusSkew.before(sr.thisUpdate) ||
nowMinusSkew.after(
nowMinusSkew.after(
sr.nextUpdate != null ? sr.nextUpdate : sr.thisUpdate))
{
throw new CertPathValidatorException(
@ -624,8 +612,10 @@ public final class OCSPResponse {
/**
* Returns the OCSP ResponseStatus.
*
* @return the {@code ResponseStatus} for this OCSP response
*/
ResponseStatus getResponseStatus() {
public ResponseStatus getResponseStatus() {
return responseStatus;
}
@ -663,11 +653,27 @@ public final class OCSPResponse {
/**
* Returns the SingleResponse of the specified CertId, or null if
* there is no response for that CertId.
*
* @param certId the {@code CertId} for a {@code SingleResponse} to be
* searched for in the OCSP response.
*
* @return the {@code SingleResponse} for the provided {@code CertId},
* or {@code null} if it is not found.
*/
SingleResponse getSingleResponse(CertId certId) {
public SingleResponse getSingleResponse(CertId certId) {
return singleResponseMap.get(certId);
}
/**
* Return a set of all CertIds in this {@code OCSPResponse}
*
* @return an unmodifiable set containing every {@code CertId} in this
* response.
*/
public Set<CertId> getCertIds() {
return Collections.unmodifiableSet(singleResponseMap.keySet());
}
/*
* Returns the certificate for the authority that signed the OCSP response.
*/
@ -675,12 +681,53 @@ public final class OCSPResponse {
return signerCert; // set in verify()
}
/**
* Get the {@code ResponderId} from this {@code OCSPResponse}
*
* @return the {@code ResponderId} from this response or {@code null}
* if no responder ID is in the body of the response (e.g. a
* response with a status other than SUCCESS.
*/
public ResponderId getResponderId() {
return respId;
}
/**
* Provide a String representation of an OCSPResponse
*
* @return a human-readable representation of the OCSPResponse
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("OCSP Response:\n");
sb.append("Response Status: ").append(responseStatus).append("\n");
sb.append("Responder ID: ").append(respId).append("\n");
sb.append("Produced at: ").append(producedAtDate).append("\n");
int count = singleResponseMap.size();
sb.append(count).append(count == 1 ?
" response:\n" : " responses:\n");
for (SingleResponse sr : singleResponseMap.values()) {
sb.append(sr).append("\n");
}
if (responseExtensions != null && responseExtensions.size() > 0) {
count = responseExtensions.size();
sb.append(count).append(count == 1 ?
" extension:\n" : " extensions:\n");
for (String extId : responseExtensions.keySet()) {
sb.append(responseExtensions.get(extId)).append("\n");
}
}
return sb.toString();
}
/**
* Build a String-Extension map from DER encoded data.
* @param derVal A {@code DerValue} object built from a SEQUENCE of
* extensions
*
* @return A {@code Map} using the OID in string form as the keys. If no
* @return a {@code Map} using the OID in string form as the keys. If no
* extensions are found or an empty SEQUENCE is passed in, then
* an empty {@code Map} will be returned.
*
@ -694,6 +741,9 @@ public final class OCSPResponse {
for (DerValue extDerVal : extDer) {
Extension ext = new Extension(extDerVal);
if (debug != null) {
debug.println("Extension: " + ext);
}
// We don't support any extensions yet. Therefore, if it
// is critical we must throw an exception because we
// don't know how to process it.
@ -710,7 +760,7 @@ public final class OCSPResponse {
/*
* A class representing a single OCSP response.
*/
final static class SingleResponse implements OCSP.RevocationStatus {
public final static class SingleResponse implements OCSP.RevocationStatus {
private final CertId certId;
private final CertStatus certStatus;
private final Date thisUpdate;
@ -825,23 +875,72 @@ public final class OCSPResponse {
/*
* Return the certificate's revocation status code
*/
@Override public CertStatus getCertStatus() {
@Override
public CertStatus getCertStatus() {
return certStatus;
}
private CertId getCertId() {
/**
* Get the Cert ID that this SingleResponse is for.
*
* @return the {@code CertId} for this {@code SingleResponse}
*/
public CertId getCertId() {
return certId;
}
@Override public Date getRevocationTime() {
/**
* Get the {@code thisUpdate} field from this {@code SingleResponse}.
*
* @return a {@link Date} object containing the thisUpdate date
*/
public Date getThisUpdate() {
return (thisUpdate != null ? (Date) thisUpdate.clone() : null);
}
/**
* Get the {@code nextUpdate} field from this {@code SingleResponse}.
*
* @return a {@link Date} object containing the nexUpdate date or
* {@code null} if a nextUpdate field is not present in the response.
*/
public Date getNextUpdate() {
return (nextUpdate != null ? (Date) nextUpdate.clone() : null);
}
/**
* Get the {@code revocationTime} field from this
* {@code SingleResponse}.
*
* @return a {@link Date} object containing the revocationTime date or
* {@code null} if the {@code SingleResponse} does not have a status
* of {@code REVOKED}.
*/
@Override
public Date getRevocationTime() {
return (revocationTime != null ? (Date) revocationTime.clone() :
null);
}
@Override public CRLReason getRevocationReason() {
/**
* Get the {@code revocationReason} field for the
* {@code SingleResponse}.
*
* @return a {@link CRLReason} containing the revocation reason, or
* {@code null} if a revocation reason was not provided or the
* response status is not {@code REVOKED}.
*/
@Override
public CRLReason getRevocationReason() {
return revocationReason;
}
/**
* Get the {@code singleExtensions} for this {@code SingleResponse}.
*
* @return a {@link Map} of {@link Extension} objects, keyed by
* their OID value in string form.
*/
@Override
public Map<String, java.security.cert.Extension> getSingleExtensions() {
return Collections.unmodifiableMap(singleExtensions);
@ -852,19 +951,22 @@ public final class OCSPResponse {
*/
@Override public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("SingleResponse: \n");
sb.append("SingleResponse:\n");
sb.append(certId);
sb.append("\nCertStatus: "+ certStatus + "\n");
sb.append("\nCertStatus: ").append(certStatus).append("\n");
if (certStatus == CertStatus.REVOKED) {
sb.append("revocationTime is " + revocationTime + "\n");
sb.append("revocationReason is " + revocationReason + "\n");
sb.append("revocationTime is ");
sb.append(revocationTime).append("\n");
sb.append("revocationReason is ");
sb.append(revocationReason).append("\n");
}
sb.append("thisUpdate is " + thisUpdate + "\n");
sb.append("thisUpdate is ").append(thisUpdate).append("\n");
if (nextUpdate != null) {
sb.append("nextUpdate is " + nextUpdate + "\n");
sb.append("nextUpdate is ").append(nextUpdate).append("\n");
}
for (java.security.cert.Extension ext : singleExtensions.values()) {
sb.append("singleExtension: " + ext + "\n");
sb.append("singleExtension: ");
sb.append(ext.toString()).append("\n");
}
return sb.toString();
}

View File

@ -0,0 +1,315 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.provider.certpath;
import java.util.Arrays;
import java.io.IOException;
import java.security.PublicKey;
import javax.security.auth.x500.X500Principal;
import sun.security.x509.KeyIdentifier;
import sun.security.util.DerValue;
/**
* Class for ResponderId entities as described in RFC6960. ResponderId objects
* are used to uniquely identify OCSP responders.
* <p>
* The RFC 6960 defines a ResponderID structure as:
* <pre>
* ResponderID ::= CHOICE {
* byName [1] Name,
* byKey [2] KeyHash }
*
* KeyHash ::= OCTET STRING -- SHA-1 hash of responder's public key
* (excluding the tag and length fields)
*
* Name is defined in RFC 5280.
* </pre>
*
* @see ResponderId.Type
* @since 1.9
*/
public final class ResponderId {
/**
* A {@code ResponderId} enumeration describing the accepted forms for a
* {@code ResponderId}.
*
* @see ResponderId
* @since 1.9
*/
public static enum Type {
/**
* A BY_NAME {@code ResponderId} will be built from a subject name,
* either as an {@code X500Principal} or a DER-encoded byte array.
*/
BY_NAME(1, "byName"),
/**
* A BY_KEY {@code ResponderId} will be built from a public key
* identifier, either derived from a {@code PublicKey} or directly
* from a DER-encoded byte array containing the key identifier.
*/
BY_KEY(2, "byKey");
private final int tagNumber;
private final String ridTypeName;
private Type(int value, String name) {
this.tagNumber = value;
this.ridTypeName = name;
}
public int value() {
return tagNumber;
}
@Override
public String toString() {
return ridTypeName;
}
}
private Type type;
private X500Principal responderName;
private KeyIdentifier responderKeyId;
private byte[] encodedRid;
/**
* Constructs a {@code ResponderId} object using an {@code X500Principal}.
* When encoded in DER this object will use the BY_NAME option.
*
* @param subjectName the subject name of the certificate used
* to sign OCSP responses.
*
* @throws IOException if the internal DER-encoding of the
* {@code X500Principal} fails.
*/
public ResponderId(X500Principal subjectName) throws IOException {
responderName = subjectName;
responderKeyId = null;
encodedRid = principalToBytes();
type = Type.BY_NAME;
}
/**
* Constructs a {@code ResponderId} object using a {@code PublicKey}.
* When encoded in DER this object will use the byKey option, a
* SHA-1 hash of the responder's public key.
*
* @param pubKey the the OCSP responder's public key
*
* @throws IOException if the internal DER-encoding of the
* {@code KeyIdentifier} fails.
*/
public ResponderId(PublicKey pubKey) throws IOException {
responderKeyId = new KeyIdentifier(pubKey);
responderName = null;
encodedRid = keyIdToBytes();
type = Type.BY_KEY;
}
/**
* Constructs a {@code ResponderId} object from its DER-encoding.
*
* @param encodedData the DER-encoded bytes
*
* @throws IOException if the encodedData is not properly DER encoded
*/
public ResponderId(byte[] encodedData) throws IOException {
DerValue outer = new DerValue(encodedData);
if (outer.isContextSpecific((byte)Type.BY_NAME.value())
&& outer.isConstructed()) {
// Use the X500Principal constructor as a way to sanity
// check the incoming data.
responderName = new X500Principal(outer.getDataBytes());
encodedRid = principalToBytes();
type = Type.BY_NAME;
} else if (outer.isContextSpecific((byte)Type.BY_KEY.value())
&& outer.isConstructed()) {
// Use the KeyIdentifier constructor as a way to sanity
// check the incoming data.
responderKeyId =
new KeyIdentifier(new DerValue(outer.getDataBytes()));
encodedRid = keyIdToBytes();
type = Type.BY_KEY;
} else {
throw new IOException("Invalid ResponderId content");
}
}
/**
* Encode a {@code ResponderId} in DER form
*
* @return a byte array containing the DER-encoded representation for this
* {@code ResponderId}
*/
public byte[] getEncoded() {
return encodedRid.clone();
}
/**
* Return the type of {@ResponderId}
*
* @return a number corresponding to the context-specific tag number
* used in the DER-encoding for a {@code ResponderId}
*/
public ResponderId.Type getType() {
return type;
}
/**
* Get the length of the encoded {@code ResponderId} (including the tag and
* length of the explicit tagging from the outer ASN.1 CHOICE).
*
* @return the length of the encoded {@code ResponderId}
*/
public int length() {
return encodedRid.length;
}
/**
* Obtain the underlying {@code X500Principal} from a {@code ResponderId}
*
* @return the {@code X500Principal} for this {@code ResponderId} if it
* is a BY_NAME variant. If the {@code ResponderId} is a BY_KEY
* variant, this routine will return {@code null}.
*/
public X500Principal getResponderName() {
return responderName;
}
/**
* Obtain the underlying key identifier from a {@code ResponderId}
*
* @return the {@code KeyIdentifier} for this {@code ResponderId} if it
* is a BY_KEY variant. If the {@code ResponderId} is a BY_NAME
* variant, this routine will return {@code null}.
*/
public KeyIdentifier getKeyIdentifier() {
return responderKeyId;
}
/**
* Compares the specified object with this {@code ResponderId} for equality.
* A ResponderId will only be considered equivalent if both the type and
* data value are equal. Two ResponderIds initialized by name and
* key ID, respectively, will not be equal even if the
* ResponderId objects are created from the same source certificate.
*
* @param obj the object to be compared against
*
* @return true if the specified object is equal to this {@code Responderid}
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (obj instanceof ResponderId) {
ResponderId respObj = (ResponderId)obj;
return Arrays.equals(encodedRid, respObj.getEncoded());
}
return false;
}
/**
* Returns the hash code value for this {@code ResponderId}
*
* @return the hash code value for this {@code ResponderId}
*/
@Override
public int hashCode() {
return Arrays.hashCode(encodedRid);
}
/**
* Create a String representation of this {@code ResponderId}
*
* @return a String representation of this {@code ResponderId}
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
switch (type) {
case BY_NAME:
sb.append(type).append(": ").append(responderName);
break;
case BY_KEY:
sb.append(type).append(": ");
for (byte keyIdByte : responderKeyId.getIdentifier()) {
sb.append(String.format("%02X", keyIdByte));
}
break;
default:
sb.append("Unknown ResponderId Type: ").append(type);
}
return sb.toString();
}
/**
* Convert the responderName data member into its DER-encoded form
*
* @return the DER encoding for a responder ID byName option, including
* explicit context-specific tagging.
*
* @throws IOException if any encoding error occurs
*/
private byte[] principalToBytes() throws IOException {
DerValue dv = new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT,
true, (byte)Type.BY_NAME.value()),
responderName.getEncoded());
return dv.toByteArray();
}
/**
* Convert the responderKeyId data member into its DER-encoded form
*
* @return the DER encoding for a responder ID byKey option, including
* explicit context-specific tagging.
*
* @throws IOException if any encoding error occurs
*/
private byte[] keyIdToBytes() throws IOException {
// Place the KeyIdentifier bytes into an OCTET STRING
DerValue inner = new DerValue(DerValue.tag_OctetString,
responderKeyId.getIdentifier());
// Mark the OCTET STRING-wrapped KeyIdentifier bytes
// as EXPLICIT CONTEXT 2
DerValue outer = new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT,
true, (byte)Type.BY_KEY.value()), inner.toByteArray());
return outer.toByteArray();
}
}

View File

@ -0,0 +1,205 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.ssl;
import java.io.IOException;
import java.util.Objects;
/*
* RFC6066 defines the TLS extension,"status_request" (type 0x5),
* which allows the client to request that the server perform OCSP
* on the client's behalf.
* The "extension data" field of this extension contains a
* "CertificateStatusRequest" structure:
*
* struct {
* CertificateStatusType status_type;
* select (status_type) {
* case ocsp: OCSPStatusRequest;
* } request;
* } CertificateStatusRequest;
*
* enum { ocsp(1), (255) } CertificateStatusType;
*
* struct {
* ResponderID responder_id_list<0..2^16-1>;
* Extensions request_extensions;
* } OCSPStatusRequest;
*
* opaque ResponderID<1..2^16-1>;
* opaque Extensions<0..2^16-1>;
*/
final class CertStatusReqExtension extends HelloExtension {
private final StatusRequestType statReqType;
private final StatusRequest request;
/**
* Construct the default status request extension object. The default
* object results in a status_request extension where the extension
* data segment is zero-length. This is used primarily in ServerHello
* messages where the server asserts it can do RFC 6066 status stapling.
*/
CertStatusReqExtension() {
super(ExtensionType.EXT_STATUS_REQUEST);
statReqType = null;
request = null;
}
/**
* Construct the status request extension object given a request type
* and {@code StatusRequest} object.
*
* @param reqType a {@code StatusRequestExtType object correspoding
* to the underlying {@code StatusRequest} object. A value of
* {@code null} is not allowed.
* @param statReq the {@code StatusRequest} object used to provide the
* encoding for the TLS extension. A value of {@code null} is not
* allowed.
*
* @throws IllegalArgumentException if the provided {@code StatusRequest}
* does not match the type.
* @throws NullPointerException if either the {@code reqType} or
* {@code statReq} arguments are {@code null}.
*/
CertStatusReqExtension(StatusRequestType reqType, StatusRequest statReq) {
super(ExtensionType.EXT_STATUS_REQUEST);
statReqType = Objects.requireNonNull(reqType,
"Unallowed null value for status_type");
request = Objects.requireNonNull(statReq,
"Unallowed null value for request");
// There is currently only one known status type (OCSP)
// We can add more clauses to cover other types in the future
if (statReqType == StatusRequestType.OCSP) {
if (!(statReq instanceof OCSPStatusRequest)) {
throw new IllegalArgumentException("StatusRequest not " +
"of type OCSPStatusRequest");
}
}
}
/**
* Construct the {@code CertStatusReqExtension} object from data read from
* a {@code HandshakeInputStream}
*
* @param s the {@code HandshakeInputStream} providing the encoded data
* @param len the length of the extension data
*
* @throws IOException if any decoding errors happen during object
* construction.
*/
CertStatusReqExtension(HandshakeInStream s, int len) throws IOException {
super(ExtensionType.EXT_STATUS_REQUEST);
if (len > 0) {
// Obtain the status type (first byte)
statReqType = StatusRequestType.get(s.getInt8());
if (statReqType == StatusRequestType.OCSP) {
request = new OCSPStatusRequest(s);
} else {
// This is a status_type we don't understand. Create
// an UnknownStatusRequest in order to preserve the data
request = new UnknownStatusRequest(s, len - 1);
}
} else {
// Treat this as a zero-length extension (i.e. from a ServerHello
statReqType = null;
request = null;
}
}
/**
* Return the length of the encoded extension, including extension type,
* extension length and status_type fields.
*
* @return the length in bytes, including the extension type and
* length fields.
*/
@Override
int length() {
return (statReqType != null ? 5 + request.length() : 4);
}
/**
* Send the encoded TLS extension through a {@code HandshakeOutputStream}
*
* @param s the {@code HandshakeOutputStream} used to send the encoded data
*
* @throws IOException tf any errors occur during the encoding process
*/
@Override
void send(HandshakeOutStream s) throws IOException {
s.putInt16(type.id);
s.putInt16(this.length() - 4);
if (statReqType != null) {
s.putInt8(statReqType.id);
request.send(s);
}
}
/**
* Create a string representation of this {@code CertStatusReqExtension}
*
* @return the string representation of this {@code CertStatusReqExtension}
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Extension ").append(type);
if (statReqType != null) {
sb.append(": ").append(statReqType).append(", ").append(request);
}
return sb.toString();
}
/**
* Return the type field for this {@code CertStatusReqExtension}
*
* @return the {@code StatusRequestType} for this extension. {@code null}
* will be returned if the default constructor is used to create
* a zero length status_request extension (found in ServerHello
* messages)
*/
StatusRequestType getType() {
return statReqType;
}
/**
* Get the underlying {@code StatusRequest} for this
* {@code CertStatusReqExtension}
*
* @return the {@code StatusRequest} or {@code null} if the default
* constructor was used to create this extension.
*/
StatusRequest getRequest() {
return request;
}
}

Some files were not shown because too many files have changed in this diff Show More