Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c3b10b94
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c3b10b94
编写于
1月 23, 2012
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7132338: Use @code friendly idiom for '\' in javadoc
Reviewed-by: alanb
上级
2bf6fa12
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
902 addition
and
903 deletion
+902
-903
src/share/classes/java/io/DataInput.java
src/share/classes/java/io/DataInput.java
+145
-146
src/share/classes/java/io/LineNumberInputStream.java
src/share/classes/java/io/LineNumberInputStream.java
+35
-35
src/share/classes/java/io/RandomAccessFile.java
src/share/classes/java/io/RandomAccessFile.java
+119
-119
src/share/classes/java/io/StreamTokenizer.java
src/share/classes/java/io/StreamTokenizer.java
+63
-63
src/share/classes/java/lang/AbstractStringBuilder.java
src/share/classes/java/lang/AbstractStringBuilder.java
+121
-121
src/share/classes/java/lang/Byte.java
src/share/classes/java/lang/Byte.java
+6
-6
src/share/classes/java/lang/Double.java
src/share/classes/java/lang/Double.java
+6
-6
src/share/classes/java/lang/Float.java
src/share/classes/java/lang/Float.java
+6
-6
src/share/classes/java/lang/Integer.java
src/share/classes/java/lang/Integer.java
+25
-25
src/share/classes/java/lang/Long.java
src/share/classes/java/lang/Long.java
+31
-31
src/share/classes/java/lang/Short.java
src/share/classes/java/lang/Short.java
+6
-6
src/share/classes/java/lang/String.java
src/share/classes/java/lang/String.java
+250
-250
src/share/classes/java/util/Properties.java
src/share/classes/java/util/Properties.java
+89
-89
未找到文件。
src/share/classes/java/io/DataInput.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 1995, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 20
12
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -26,12 +26,12 @@
...
@@ -26,12 +26,12 @@
package
java.io
;
package
java.io
;
/**
/**
* The
<code>DataInput</code>
interface provides
* The
{@code DataInput}
interface provides
* for reading bytes from a binary stream and
* for reading bytes from a binary stream and
* reconstructing from them data in any of
* reconstructing from them data in any of
* the Java primitive types. There is also
* the Java primitive types. There is also
* a
* a
* facility for reconstructing a
<code>String</code>
* facility for reconstructing a
{@code String}
* from data in
* from data in
* <a href="#modified-utf-8">modified UTF-8</a>
* <a href="#modified-utf-8">modified UTF-8</a>
* format.
* format.
...
@@ -39,12 +39,12 @@ package java.io;
...
@@ -39,12 +39,12 @@ package java.io;
* It is generally true of all the reading
* It is generally true of all the reading
* routines in this interface that if end of
* routines in this interface that if end of
* file is reached before the desired number
* file is reached before the desired number
* of bytes has been read, an
<code>EOFException</code>
* of bytes has been read, an
{@code EOFException}
* (which is a kind of
<code>IOException</code>
)
* (which is a kind of
{@code IOException}
)
* is thrown. If any byte cannot be read for
* is thrown. If any byte cannot be read for
* any reason other than end of file, an
<code>IOException</code>
* any reason other than end of file, an
{@code IOException}
* other than
<code>EOFException</code>
is
* other than
{@code EOFException}
is
* thrown. In particular, an
<code>IOException</code>
* thrown. In particular, an
{@code IOException}
* may be thrown if the input stream has been
* may be thrown if the input stream has been
* closed.
* closed.
*
*
...
@@ -58,8 +58,8 @@ package java.io;
...
@@ -58,8 +58,8 @@ package java.io;
* Note that in the following tables, the most significant bit appears in the
* Note that in the following tables, the most significant bit appears in the
* far left-hand column.
* far left-hand column.
* <p>
* <p>
* All characters in the range
<code>'\u0001'</code>
to
* All characters in the range
{@code '\u005Cu0001'}
to
*
<code>'\u007F'</code>
are represented by a single byte:
*
{@code '\u005Cu007F'}
are represented by a single byte:
*
*
* <blockquote>
* <blockquote>
* <table border="1" cellspacing="0" cellpadding="8" width="50%"
* <table border="1" cellspacing="0" cellpadding="8" width="50%"
...
@@ -83,8 +83,8 @@ package java.io;
...
@@ -83,8 +83,8 @@ package java.io;
* </blockquote>
* </blockquote>
*
*
* <p>
* <p>
* The null character
<code>'\u0000'</code>
and characters in the
* The null character
{@code '\u005Cu0000'}
and characters in the
* range
<code>'\u0080'</code> to <code>'\u07FF'</code>
are
* range
{@code '\u005Cu0080'} to {@code '\u005Cu07FF'}
are
* represented by a pair of bytes:
* represented by a pair of bytes:
*
*
* <blockquote>
* <blockquote>
...
@@ -123,8 +123,8 @@ package java.io;
...
@@ -123,8 +123,8 @@ package java.io;
* </blockquote>
* </blockquote>
*
*
* <br>
* <br>
*
<code>char</code> values in the range <code>'\u0800'</code>
to
*
{@code char} values in the range {@code '\u005Cu0800'}
to
*
<code>'\uFFFF'</code>
are represented by three bytes:
*
{@code '\u005CuFFFF'}
are represented by three bytes:
*
*
* <blockquote>
* <blockquote>
* <table border="1" cellspacing="0" cellpadding="8" width="50%"
* <table border="1" cellspacing="0" cellpadding="8" width="50%"
...
@@ -178,7 +178,7 @@ package java.io;
...
@@ -178,7 +178,7 @@ package java.io;
* The differences between this format and the
* The differences between this format and the
* standard UTF-8 format are the following:
* standard UTF-8 format are the following:
* <ul>
* <ul>
* <li>The null byte
<code>'\u0000'</code>
is encoded in 2-byte format
* <li>The null byte
{@code '\u005Cu0000'}
is encoded in 2-byte format
* rather than 1-byte, so that the encoded strings never have
* rather than 1-byte, so that the encoded strings never have
* embedded nulls.
* embedded nulls.
* <li>Only the 1-byte, 2-byte, and 3-byte formats are used.
* <li>Only the 1-byte, 2-byte, and 3-byte formats are used.
...
@@ -195,36 +195,36 @@ interface DataInput {
...
@@ -195,36 +195,36 @@ interface DataInput {
/**
/**
* Reads some bytes from an input
* Reads some bytes from an input
* stream and stores them into the buffer
* stream and stores them into the buffer
* array
<code>b</code>
. The number of bytes
* array
{@code b}
. The number of bytes
* read is equal
* read is equal
* to the length of
<code>b</code>
.
* to the length of
{@code b}
.
* <p>
* <p>
* This method blocks until one of the
* This method blocks until one of the
* following conditions occurs:<p>
* following conditions occurs:<p>
* <ul>
* <ul>
* <li>
<code>b.length</code>
* <li>
{@code b.length}
* bytes of input data are available, in which
* bytes of input data are available, in which
* case a normal return is made.
* case a normal return is made.
*
*
* <li>End of
* <li>End of
* file is detected, in which case an
<code>EOFException</code>
* file is detected, in which case an
{@code EOFException}
* is thrown.
* is thrown.
*
*
* <li>An I/O error occurs, in
* <li>An I/O error occurs, in
* which case an
<code>IOException</code>
other
* which case an
{@code IOException}
other
* than
<code>EOFException</code>
is thrown.
* than
{@code EOFException}
is thrown.
* </ul>
* </ul>
* <p>
* <p>
* If
<code>b</code> is <code>null</code>
,
* If
{@code b} is {@code null}
,
* a
<code>NullPointerException</code>
is thrown.
* a
{@code NullPointerException}
is thrown.
* If
<code>b.length</code>
is zero, then
* If
{@code b.length}
is zero, then
* no bytes are read. Otherwise, the first
* no bytes are read. Otherwise, the first
* byte read is stored into element
<code>b[0]</code>
,
* byte read is stored into element
{@code b[0]}
,
* the next one into
<code>b[1]</code>
, and
* the next one into
{@code b[1]}
, and
* so on.
* so on.
* If an exception is thrown from
* If an exception is thrown from
* this method, then it may be that some but
* this method, then it may be that some but
* not all bytes of
<code>b</code>
have been
* not all bytes of
{@code b}
have been
* updated with data from the input stream.
* updated with data from the input stream.
*
*
* @param b the buffer into which the data is read.
* @param b the buffer into which the data is read.
...
@@ -236,7 +236,7 @@ interface DataInput {
...
@@ -236,7 +236,7 @@ interface DataInput {
/**
/**
*
*
* Reads
<code>len</code>
* Reads
{@code len}
* bytes from
* bytes from
* an input stream.
* an input stream.
* <p>
* <p>
...
@@ -244,32 +244,32 @@ interface DataInput {
...
@@ -244,32 +244,32 @@ interface DataInput {
* blocks until one of the following conditions
* blocks until one of the following conditions
* occurs:<p>
* occurs:<p>
* <ul>
* <ul>
* <li>
<code>len</code>
bytes
* <li>
{@code len}
bytes
* of input data are available, in which case
* of input data are available, in which case
* a normal return is made.
* a normal return is made.
*
*
* <li>End of file
* <li>End of file
* is detected, in which case an
<code>EOFException</code>
* is detected, in which case an
{@code EOFException}
* is thrown.
* is thrown.
*
*
* <li>An I/O error occurs, in
* <li>An I/O error occurs, in
* which case an
<code>IOException</code>
other
* which case an
{@code IOException}
other
* than
<code>EOFException</code>
is thrown.
* than
{@code EOFException}
is thrown.
* </ul>
* </ul>
* <p>
* <p>
* If
<code>b</code> is <code>null</code>
,
* If
{@code b} is {@code null}
,
* a
<code>NullPointerException</code>
is thrown.
* a
{@code NullPointerException}
is thrown.
* If
<code>off</code> is negative, or <code>len</code>
* If
{@code off} is negative, or {@code len}
* is negative, or
<code>off+len</code>
is
* is negative, or
{@code off+len}
is
* greater than the length of the array
<code>b</code>
,
* greater than the length of the array
{@code b}
,
* then an
<code>IndexOutOfBoundsException</code>
* then an
{@code IndexOutOfBoundsException}
* is thrown.
* is thrown.
* If
<code>len</code>
is zero,
* If
{@code len}
is zero,
* then no bytes are read. Otherwise, the first
* then no bytes are read. Otherwise, the first
* byte read is stored into element
<code>b[off]</code>
,
* byte read is stored into element
{@code b[off]}
,
* the next one into
<code>b[off+1]</code>
,
* the next one into
{@code b[off+1]}
,
* and so on. The number of bytes read is,
* and so on. The number of bytes read is,
* at most, equal to
<code>len</code>
.
* at most, equal to
{@code len}
.
*
*
* @param b the buffer into which the data is read.
* @param b the buffer into which the data is read.
* @param off an int specifying the offset into the data.
* @param off an int specifying the offset into the data.
...
@@ -282,7 +282,7 @@ interface DataInput {
...
@@ -282,7 +282,7 @@ interface DataInput {
/**
/**
* Makes an attempt to skip over
* Makes an attempt to skip over
*
<code>n</code>
bytes
*
{@code n}
bytes
* of data from the input
* of data from the input
* stream, discarding the skipped bytes. However,
* stream, discarding the skipped bytes. However,
* it may skip
* it may skip
...
@@ -290,10 +290,10 @@ interface DataInput {
...
@@ -290,10 +290,10 @@ interface DataInput {
* bytes, possibly zero. This may result from
* bytes, possibly zero. This may result from
* any of a
* any of a
* number of conditions; reaching
* number of conditions; reaching
* end of file before
<code>n</code>
bytes
* end of file before
{@code n}
bytes
* have been skipped is
* have been skipped is
* only one possibility.
* only one possibility.
* This method never throws an
<code>EOFException</code>
.
* This method never throws an
{@code EOFException}
.
* The actual
* The actual
* number of bytes skipped is returned.
* number of bytes skipped is returned.
*
*
...
@@ -305,13 +305,13 @@ interface DataInput {
...
@@ -305,13 +305,13 @@ interface DataInput {
/**
/**
* Reads one input byte and returns
* Reads one input byte and returns
*
<code>true</code>
if that byte is nonzero,
*
{@code true}
if that byte is nonzero,
*
<code>false</code>
if that byte is zero.
*
{@code false}
if that byte is zero.
* This method is suitable for reading
* This method is suitable for reading
* the byte written by the
<code>writeBoolean</code>
* the byte written by the
{@code writeBoolean}
* method of interface
<code>DataOutput</code>
.
* method of interface
{@code DataOutput}
.
*
*
* @return the
<code>boolean</code>
value read.
* @return the
{@code boolean}
value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
* all the bytes.
* all the bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -321,11 +321,11 @@ interface DataInput {
...
@@ -321,11 +321,11 @@ interface DataInput {
/**
/**
* Reads and returns one input byte.
* Reads and returns one input byte.
* The byte is treated as a signed value in
* The byte is treated as a signed value in
* the range
<code>-128</code> through <code>127</code>
,
* the range
{@code -128} through {@code 127}
,
* inclusive.
* inclusive.
* This method is suitable for
* This method is suitable for
* reading the byte written by the
<code>writeByte</code>
* reading the byte written by the
{@code writeByte}
* method of interface
<code>DataOutput</code>
.
* method of interface
{@code DataOutput}
.
*
*
* @return the 8-bit value read.
* @return the 8-bit value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
...
@@ -336,16 +336,16 @@ interface DataInput {
...
@@ -336,16 +336,16 @@ interface DataInput {
/**
/**
* Reads one input byte, zero-extends
* Reads one input byte, zero-extends
* it to type
<code>int</code>
, and returns
* it to type
{@code int}
, and returns
* the result, which is therefore in the range
* the result, which is therefore in the range
*
<code>0</code>
*
{@code 0}
* through
<code>255</code>
.
* through
{@code 255}
.
* This method is suitable for reading
* This method is suitable for reading
* the byte written by the
<code>writeByte</code>
* the byte written by the
{@code writeByte}
* method of interface
<code>DataOutput</code>
* method of interface
{@code DataOutput}
* if the argument to
<code>writeByte</code>
* if the argument to
{@code writeByte}
* was intended to be a value in the range
* was intended to be a value in the range
*
<code>0</code> through <code>255</code>
.
*
{@code 0} through {@code 255}
.
*
*
* @return the unsigned 8-bit value read.
* @return the unsigned 8-bit value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
...
@@ -356,8 +356,8 @@ interface DataInput {
...
@@ -356,8 +356,8 @@ interface DataInput {
/**
/**
* Reads two input bytes and returns
* Reads two input bytes and returns
* a
<code>short</code> value. Let <code>a</code>
* a
{@code short} value. Let {@code a}
* be the first byte read and
<code>b</code>
* be the first byte read and
{@code b}
* be the second byte. The value
* be the second byte. The value
* returned
* returned
* is:
* is:
...
@@ -365,8 +365,8 @@ interface DataInput {
...
@@ -365,8 +365,8 @@ interface DataInput {
* </code></pre>
* </code></pre>
* This method
* This method
* is suitable for reading the bytes written
* is suitable for reading the bytes written
* by the
<code>writeShort</code>
method of
* by the
{@code writeShort}
method of
* interface
<code>DataOutput</code>
.
* interface
{@code DataOutput}
.
*
*
* @return the 16-bit value read.
* @return the 16-bit value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
...
@@ -377,19 +377,19 @@ interface DataInput {
...
@@ -377,19 +377,19 @@ interface DataInput {
/**
/**
* Reads two input bytes and returns
* Reads two input bytes and returns
* an
<code>int</code> value in the range <code>0</code>
* an
{@code int} value in the range {@code 0}
* through
<code>65535</code>. Let <code>a</code>
* through
{@code 65535}. Let {@code a}
* be the first byte read and
* be the first byte read and
*
<code>b</code>
*
{@code b}
* be the second byte. The value returned is:
* be the second byte. The value returned is:
* <p><pre><code>(((a & 0xff) << 8) | (b & 0xff))
* <p><pre><code>(((a & 0xff) << 8) | (b & 0xff))
* </code></pre>
* </code></pre>
* This method is suitable for reading the bytes
* This method is suitable for reading the bytes
* written by the
<code>writeShort</code>
method
* written by the
{@code writeShort}
method
* of interface
<code>DataOutput</code>
if
* of interface
{@code DataOutput}
if
* the argument to
<code>writeShort</code>
* the argument to
{@code writeShort}
* was intended to be a value in the range
* was intended to be a value in the range
*
<code>0</code> through <code>65535</code>
.
*
{@code 0} through {@code 65535}
.
*
*
* @return the unsigned 16-bit value read.
* @return the unsigned 16-bit value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
...
@@ -399,19 +399,19 @@ interface DataInput {
...
@@ -399,19 +399,19 @@ interface DataInput {
int
readUnsignedShort
()
throws
IOException
;
int
readUnsignedShort
()
throws
IOException
;
/**
/**
* Reads two input bytes and returns a
<code>char</code>
value.
* Reads two input bytes and returns a
{@code char}
value.
* Let
<code>a</code>
* Let
{@code a}
* be the first byte read and
<code>b</code>
* be the first byte read and
{@code b}
* be the second byte. The value
* be the second byte. The value
* returned is:
* returned is:
* <p><pre><code>(char)((a << 8) | (b & 0xff))
* <p><pre><code>(char)((a << 8) | (b & 0xff))
* </code></pre>
* </code></pre>
* This method
* This method
* is suitable for reading bytes written by
* is suitable for reading bytes written by
* the
<code>writeChar</code>
method of interface
* the
{@code writeChar}
method of interface
*
<code>DataOutput</code>
.
*
{@code DataOutput}
.
*
*
* @return the
<code>char</code>
value read.
* @return the
{@code char}
value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
* all the bytes.
* all the bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -420,18 +420,17 @@ interface DataInput {
...
@@ -420,18 +420,17 @@ interface DataInput {
/**
/**
* Reads four input bytes and returns an
* Reads four input bytes and returns an
*
<code>int</code> value. Let <code>a-d</code>
*
{@code int} value. Let {@code a-d}
* be the first through fourth bytes read. The value returned is:
* be the first through fourth bytes read. The value returned is:
* <p><pre>
* <p><pre><code>
* <code>
* (((a & 0xff) << 24) | ((b & 0xff) << 16) |
* (((a & 0xff) << 24) | ((b & 0xff) << 16) |
*  ((c & 0xff) << 8) | (d & 0xff))
*  ((c & 0xff) << 8) | (d & 0xff))
* </code></pre>
* </code></pre>
* This method is suitable
* This method is suitable
* for reading bytes written by the
<code>writeInt</code>
* for reading bytes written by the
{@code writeInt}
* method of interface
<code>DataOutput</code>
.
* method of interface
{@code DataOutput}
.
*
*
* @return the
<code>int</code>
value read.
* @return the
{@code int}
value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
* all the bytes.
* all the bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -440,10 +439,10 @@ interface DataInput {
...
@@ -440,10 +439,10 @@ interface DataInput {
/**
/**
* Reads eight input bytes and returns
* Reads eight input bytes and returns
* a
<code>long</code> value. Let <code>a-h</code>
* a
{@code long} value. Let {@code a-h}
* be the first through eighth bytes read.
* be the first through eighth bytes read.
* The value returned is:
* The value returned is:
* <p><pre>
<code>
* <p><pre><code>
* (((long)(a & 0xff) << 56) |
* (((long)(a & 0xff) << 56) |
* ((long)(b & 0xff) << 48) |
* ((long)(b & 0xff) << 48) |
* ((long)(c & 0xff) << 40) |
* ((long)(c & 0xff) << 40) |
...
@@ -455,10 +454,10 @@ interface DataInput {
...
@@ -455,10 +454,10 @@ interface DataInput {
* </code></pre>
* </code></pre>
* <p>
* <p>
* This method is suitable
* This method is suitable
* for reading bytes written by the
<code>writeLong</code>
* for reading bytes written by the
{@code writeLong}
* method of interface
<code>DataOutput</code>
.
* method of interface
{@code DataOutput}
.
*
*
* @return the
<code>long</code>
value read.
* @return the
{@code long}
value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
* all the bytes.
* all the bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -467,18 +466,18 @@ interface DataInput {
...
@@ -467,18 +466,18 @@ interface DataInput {
/**
/**
* Reads four input bytes and returns
* Reads four input bytes and returns
* a
<code>float</code>
value. It does this
* a
{@code float}
value. It does this
* by first constructing an
<code>int</code>
* by first constructing an
{@code int}
* value in exactly the manner
* value in exactly the manner
* of the
<code>readInt</code>
* of the
{@code readInt}
* method, then converting this
<code>int</code>
* method, then converting this
{@code int}
* value to a
<code>float</code>
in
* value to a
{@code float}
in
* exactly the manner of the method
<code>Float.intBitsToFloat</code>
.
* exactly the manner of the method
{@code Float.intBitsToFloat}
.
* This method is suitable for reading
* This method is suitable for reading
* bytes written by the
<code>writeFloat</code>
* bytes written by the
{@code writeFloat}
* method of interface
<code>DataOutput</code>
.
* method of interface
{@code DataOutput}
.
*
*
* @return the
<code>float</code>
value read.
* @return the
{@code float}
value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
* all the bytes.
* all the bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -487,18 +486,18 @@ interface DataInput {
...
@@ -487,18 +486,18 @@ interface DataInput {
/**
/**
* Reads eight input bytes and returns
* Reads eight input bytes and returns
* a
<code>double</code>
value. It does this
* a
{@code double}
value. It does this
* by first constructing a
<code>long</code>
* by first constructing a
{@code long}
* value in exactly the manner
* value in exactly the manner
* of the
<code>readlong</code>
* of the
{@code readlong}
* method, then converting this
<code>long</code>
* method, then converting this
{@code long}
* value to a
<code>double</code>
in exactly
* value to a
{@code double}
in exactly
* the manner of the method
<code>Double.longBitsToDouble</code>
.
* the manner of the method
{@code Double.longBitsToDouble}
.
* This method is suitable for reading
* This method is suitable for reading
* bytes written by the
<code>writeDouble</code>
* bytes written by the
{@code writeDouble}
* method of interface
<code>DataOutput</code>
.
* method of interface
{@code DataOutput}
.
*
*
* @return the
<code>double</code>
value read.
* @return the
{@code double}
value read.
* @exception EOFException if this stream reaches the end before reading
* @exception EOFException if this stream reaches the end before reading
* all the bytes.
* all the bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -512,35 +511,35 @@ interface DataInput {
...
@@ -512,35 +511,35 @@ interface DataInput {
* until it encounters a line terminator or
* until it encounters a line terminator or
* end of
* end of
* file; the characters read are then
* file; the characters read are then
* returned as a
<code>String</code>
. Note
* returned as a
{@code String}
. Note
* that because this
* that because this
* method processes bytes,
* method processes bytes,
* it does not support input of the full Unicode
* it does not support input of the full Unicode
* character set.
* character set.
* <p>
* <p>
* If end of file is encountered
* If end of file is encountered
* before even one byte can be read, then
<code>null</code>
* before even one byte can be read, then
{@code null}
* is returned. Otherwise, each byte that is
* is returned. Otherwise, each byte that is
* read is converted to type
<code>char</code>
* read is converted to type
{@code char}
* by zero-extension. If the character
<code>'\n'</code>
* by zero-extension. If the character
{@code '\n'}
* is encountered, it is discarded and reading
* is encountered, it is discarded and reading
* ceases. If the character
<code>'\r'</code>
* ceases. If the character
{@code '\r'}
* is encountered, it is discarded and, if
* is encountered, it is discarded and, if
* the following byte converts  to the
* the following byte converts  to the
* character
<code>'\n'</code>
, then that is
* character
{@code '\n'}
, then that is
* discarded also; reading then ceases. If
* discarded also; reading then ceases. If
* end of file is encountered before either
* end of file is encountered before either
* of the characters
<code>'\n'</code>
and
* of the characters
{@code '\n'}
and
*
<code>'\r'</code>
is encountered, reading
*
{@code '\r'}
is encountered, reading
* ceases. Once reading has ceased, a
<code>String</code>
* ceases. Once reading has ceased, a
{@code String}
* is returned that contains all the characters
* is returned that contains all the characters
* read and not discarded, taken in order.
* read and not discarded, taken in order.
* Note that every character in this string
* Note that every character in this string
* will have a value less than
<code>\u0100</code>
,
* will have a value less than
{@code \u005Cu0100}
,
* that is,
<code>(char)256</code>
.
* that is,
{@code (char)256}
.
*
*
* @return the next line of text from the input stream,
* @return the next line of text from the input stream,
* or
<CODE>null</CODE>
if the end of file is
* or
{@code null}
if the end of file is
* encountered before a byte can be read.
* encountered before a byte can be read.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
...
@@ -550,15 +549,15 @@ interface DataInput {
...
@@ -550,15 +549,15 @@ interface DataInput {
* Reads in a string that has been encoded using a
* Reads in a string that has been encoded using a
* <a href="#modified-utf-8">modified UTF-8</a>
* <a href="#modified-utf-8">modified UTF-8</a>
* format.
* format.
* The general contract of
<code>readUTF</code>
* The general contract of
{@code readUTF}
* is that it reads a representation of a Unicode
* is that it reads a representation of a Unicode
* character string encoded in modified
* character string encoded in modified
* UTF-8 format; this string of characters
* UTF-8 format; this string of characters
* is then returned as a
<code>String</code>
.
* is then returned as a
{@code String}
.
* <p>
* <p>
* First, two bytes are read and used to
* First, two bytes are read and used to
* construct an unsigned 16-bit integer in
* construct an unsigned 16-bit integer in
* exactly the manner of the
<code>readUnsignedShort</code>
* exactly the manner of the
{@code readUnsignedShort}
* method . This integer value is called the
* method . This integer value is called the
* <i>UTF length</i> and specifies the number
* <i>UTF length</i> and specifies the number
* of additional bytes to be read. These bytes
* of additional bytes to be read. These bytes
...
@@ -570,58 +569,58 @@ interface DataInput {
...
@@ -570,58 +569,58 @@ interface DataInput {
* next group.
* next group.
* <p>
* <p>
* If the first byte of a group
* If the first byte of a group
* matches the bit pattern
<code>0xxxxxxx</code>
* matches the bit pattern
{@code 0xxxxxxx}
* (where
<code>x</code> means "may be <code>0</code>
* (where
{@code x} means "may be {@code 0}
* or
<code>1</code>
"), then the group consists
* or
{@code 1}
"), then the group consists
* of just that byte. The byte is zero-extended
* of just that byte. The byte is zero-extended
* to form a character.
* to form a character.
* <p>
* <p>
* If the first byte
* If the first byte
* of a group matches the bit pattern
<code>110xxxxx</code>
,
* of a group matches the bit pattern
{@code 110xxxxx}
,
* then the group consists of that byte
<code>a</code>
* then the group consists of that byte
{@code a}
* and a second byte
<code>b</code>
. If there
* and a second byte
{@code b}
. If there
* is no byte
<code>b</code>
(because byte
* is no byte
{@code b}
(because byte
*
<code>a</code>
was the last of the bytes
*
{@code a}
was the last of the bytes
* to be read), or if byte
<code>b</code>
does
* to be read), or if byte
{@code b}
does
* not match the bit pattern
<code>10xxxxxx</code>
,
* not match the bit pattern
{@code 10xxxxxx}
,
* then a
<code>UTFDataFormatException</code>
* then a
{@code UTFDataFormatException}
* is thrown. Otherwise, the group is converted
* is thrown. Otherwise, the group is converted
* to the character:<p>
* to the character:<p>
* <pre><code>(char)(((a& 0x1F) << 6) | (b & 0x3F))
* <pre><code>(char)(((a& 0x1F) << 6) | (b & 0x3F))
* </code></pre>
* </code></pre>
* If the first byte of a group
* If the first byte of a group
* matches the bit pattern
<code>1110xxxx</code>
,
* matches the bit pattern
{@code 1110xxxx}
,
* then the group consists of that byte
<code>a</code>
* then the group consists of that byte
{@code a}
* and two more bytes
<code>b</code> and <code>c</code>
.
* and two more bytes
{@code b} and {@code c}
.
* If there is no byte
<code>c</code>
(because
* If there is no byte
{@code c}
(because
* byte
<code>a</code>
was one of the last
* byte
{@code a}
was one of the last
* two of the bytes to be read), or either
* two of the bytes to be read), or either
* byte
<code>b</code> or byte <code>c</code>
* byte
{@code b} or byte {@code c}
* does not match the bit pattern
<code>10xxxxxx</code>
,
* does not match the bit pattern
{@code 10xxxxxx}
,
* then a
<code>UTFDataFormatException</code>
* then a
{@code UTFDataFormatException}
* is thrown. Otherwise, the group is converted
* is thrown. Otherwise, the group is converted
* to the character:<p>
* to the character:<p>
* <pre><code>
* <pre><code>
* (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
* (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
* </code></pre>
* </code></pre>
* If the first byte of a group matches the
* If the first byte of a group matches the
* pattern
<code>1111xxxx</code>
or the pattern
* pattern
{@code 1111xxxx}
or the pattern
*
<code>10xxxxxx</code>, then a <code>UTFDataFormatException</code>
*
{@code 10xxxxxx}, then a {@code UTFDataFormatException}
* is thrown.
* is thrown.
* <p>
* <p>
* If end of file is encountered
* If end of file is encountered
* at any time during this entire process,
* at any time during this entire process,
* then an
<code>EOFException</code>
is thrown.
* then an
{@code EOFException}
is thrown.
* <p>
* <p>
* After every group has been converted to
* After every group has been converted to
* a character by this process, the characters
* a character by this process, the characters
* are gathered, in the same order in which
* are gathered, in the same order in which
* their corresponding groups were read from
* their corresponding groups were read from
* the input stream, to form a
<code>String</code>
,
* the input stream, to form a
{@code String}
,
* which is returned.
* which is returned.
* <p>
* <p>
* The
<code>writeUTF</code>
* The
{@code writeUTF}
* method of interface
<code>DataOutput</code>
* method of interface
{@code DataOutput}
* may be used to write data that is suitable
* may be used to write data that is suitable
* for reading by this method.
* for reading by this method.
* @return a Unicode string.
* @return a Unicode string.
...
...
src/share/classes/java/io/LineNumberInputStream.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 1995, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 20
12
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -30,13 +30,13 @@ package java.io;
...
@@ -30,13 +30,13 @@ package java.io;
* functionality of keeping track of the current line number.
* functionality of keeping track of the current line number.
* <p>
* <p>
* A line is a sequence of bytes ending with a carriage return
* A line is a sequence of bytes ending with a carriage return
* character (
<code>'\r'</code>
), a newline character
* character (
{@code '\u005Cr'}
), a newline character
* (
<code>'\n'</code>
), or a carriage return character followed
* (
{@code '\u005Cn'}
), or a carriage return character followed
* immediately by a linefeed character. In all three cases, the line
* immediately by a linefeed character. In all three cases, the line
* terminating character(s) are returned as a single newline character.
* terminating character(s) are returned as a single newline character.
* <p>
* <p>
* The line number begins at
<code>0</code>
, and is incremented by
* The line number begins at
{@code 0}
, and is incremented by
*
<code>1</code> when a <code>read</code>
returns a newline character.
*
{@code 1} when a {@code read}
returns a newline character.
*
*
* @author Arthur van Hoff
* @author Arthur van Hoff
* @see java.io.LineNumberReader
* @see java.io.LineNumberReader
...
@@ -66,22 +66,22 @@ class LineNumberInputStream extends FilterInputStream {
...
@@ -66,22 +66,22 @@ class LineNumberInputStream extends FilterInputStream {
/**
/**
* Reads the next byte of data from this input stream. The value
* Reads the next byte of data from this input stream. The value
* byte is returned as an
<code>int</code>
in the range
* byte is returned as an
{@code int}
in the range
*
<code>0</code> to <code>255</code>
. If no byte is available
*
{@code 0} to {@code 255}
. If no byte is available
* because the end of the stream has been reached, the value
* because the end of the stream has been reached, the value
*
<code>-1</code>
is returned. This method blocks until input data
*
{@code -1}
is returned. This method blocks until input data
* is available, the end of the stream is detected, or an exception
* is available, the end of the stream is detected, or an exception
* is thrown.
* is thrown.
* <p>
* <p>
* The
<code>read</code>
method of
* The
{@code read}
method of
*
<code>LineNumberInputStream</code> calls the <code>read</code>
*
{@code LineNumberInputStream} calls the {@code read}
* method of the underlying input stream. It checks for carriage
* method of the underlying input stream. It checks for carriage
* returns and newline characters in the input, and modifies the
* returns and newline characters in the input, and modifies the
* current line number as appropriate. A carriage-return character or
* current line number as appropriate. A carriage-return character or
* a carriage return followed by a newline character are both
* a carriage return followed by a newline character are both
* converted into a single newline character.
* converted into a single newline character.
*
*
* @return the next byte of data, or
<code>-1</code>
if the end of this
* @return the next byte of data, or
{@code -1}
if the end of this
* stream is reached.
* stream is reached.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
* @see java.io.FilterInputStream#in
* @see java.io.FilterInputStream#in
...
@@ -111,18 +111,18 @@ class LineNumberInputStream extends FilterInputStream {
...
@@ -111,18 +111,18 @@ class LineNumberInputStream extends FilterInputStream {
}
}
/**
/**
* Reads up to
<code>len</code>
bytes of data from this input stream
* Reads up to
{@code len}
bytes of data from this input stream
* into an array of bytes. This method blocks until some input is available.
* into an array of bytes. This method blocks until some input is available.
* <p>
* <p>
* The
<code>read</code>
method of
* The
{@code read}
method of
*
<code>LineNumberInputStream</code>
repeatedly calls the
*
{@code LineNumberInputStream}
repeatedly calls the
*
<code>read</code>
method of zero arguments to fill in the byte array.
*
{@code read}
method of zero arguments to fill in the byte array.
*
*
* @param b the buffer into which the data is read.
* @param b the buffer into which the data is read.
* @param off the start offset of the data.
* @param off the start offset of the data.
* @param len the maximum number of bytes read.
* @param len the maximum number of bytes read.
* @return the total number of bytes read into the buffer, or
* @return the total number of bytes read into the buffer, or
*
<code>-1</code>
if there is no more data because the end of
*
{@code -1}
if there is no more data because the end of
* this stream has been reached.
* this stream has been reached.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
* @see java.io.LineNumberInputStream#read()
* @see java.io.LineNumberInputStream#read()
...
@@ -160,15 +160,15 @@ class LineNumberInputStream extends FilterInputStream {
...
@@ -160,15 +160,15 @@ class LineNumberInputStream extends FilterInputStream {
}
}
/**
/**
* Skips over and discards
<code>n</code>
bytes of data from this
* Skips over and discards
{@code n}
bytes of data from this
* input stream. The
<code>skip</code>
method may, for a variety of
* input stream. The
{@code skip}
method may, for a variety of
* reasons, end up skipping over some smaller number of bytes,
* reasons, end up skipping over some smaller number of bytes,
* possibly
<code>0</code>
. The actual number of bytes skipped is
* possibly
{@code 0}
. The actual number of bytes skipped is
* returned. If
<code>n</code>
is negative, no bytes are skipped.
* returned. If
{@code n}
is negative, no bytes are skipped.
* <p>
* <p>
* The
<code>skip</code> method of <code>LineNumberInputStream</code>
creates
* The
{@code skip} method of {@code LineNumberInputStream}
creates
* a byte array and then repeatedly reads into it until
* a byte array and then repeatedly reads into it until
*
<code>n</code>
bytes have been read or the end of the stream has
*
{@code n}
bytes have been read or the end of the stream has
* been reached.
* been reached.
*
*
* @param n the number of bytes to be skipped.
* @param n the number of bytes to be skipped.
...
@@ -225,12 +225,12 @@ class LineNumberInputStream extends FilterInputStream {
...
@@ -225,12 +225,12 @@ class LineNumberInputStream extends FilterInputStream {
* <p>
* <p>
* Note that if the underlying input stream is able to supply
* Note that if the underlying input stream is able to supply
* <i>k</i> input characters without blocking, the
* <i>k</i> input characters without blocking, the
*
<code>LineNumberInputStream</code>
can guarantee only to provide
*
{@code LineNumberInputStream}
can guarantee only to provide
* <i>k</i>/2 characters without blocking, because the
* <i>k</i>/2 characters without blocking, because the
* <i>k</i> characters from the underlying input stream might
* <i>k</i> characters from the underlying input stream might
* consist of <i>k</i>/2 pairs of
<code>'\r'</code>
and
* consist of <i>k</i>/2 pairs of
{@code '\u005Cr'}
and
*
<code>'\n'</code>
, which are converted to just
*
{@code '\u005Cn'}
, which are converted to just
* <i>k</i>/2
<code>'\n'</code>
characters.
* <i>k</i>/2
{@code '\u005Cn'}
characters.
*
*
* @return the number of bytes that can be read from this input stream
* @return the number of bytes that can be read from this input stream
* without blocking.
* without blocking.
...
@@ -243,12 +243,12 @@ class LineNumberInputStream extends FilterInputStream {
...
@@ -243,12 +243,12 @@ class LineNumberInputStream extends FilterInputStream {
/**
/**
* Marks the current position in this input stream. A subsequent
* Marks the current position in this input stream. A subsequent
* call to the
<code>reset</code>
method repositions this stream at
* call to the
{@code reset}
method repositions this stream at
* the last marked position so that subsequent reads re-read the same bytes.
* the last marked position so that subsequent reads re-read the same bytes.
* <p>
* <p>
* The
<code>mark</code>
method of
* The
{@code mark}
method of
*
<code>LineNumberInputStream</code>
remembers the current line
*
{@code LineNumberInputStream}
remembers the current line
* number in a private variable, and then calls the
<code>mark</code>
* number in a private variable, and then calls the
{@code mark}
* method of the underlying input stream.
* method of the underlying input stream.
*
*
* @param readlimit the maximum limit of bytes that can be read before
* @param readlimit the maximum limit of bytes that can be read before
...
@@ -264,12 +264,12 @@ class LineNumberInputStream extends FilterInputStream {
...
@@ -264,12 +264,12 @@ class LineNumberInputStream extends FilterInputStream {
/**
/**
* Repositions this stream to the position at the time the
* Repositions this stream to the position at the time the
*
<code>mark</code>
method was last called on this input stream.
*
{@code mark}
method was last called on this input stream.
* <p>
* <p>
* The
<code>reset</code>
method of
* The
{@code reset}
method of
*
<code>LineNumberInputStream</code>
resets the line number to be
*
{@code LineNumberInputStream}
resets the line number to be
* the line number at the time the
<code>mark</code>
method was
* the line number at the time the
{@code mark}
method was
* called, and then calls the
<code>reset</code>
method of the
* called, and then calls the
{@code reset}
method of the
* underlying input stream.
* underlying input stream.
* <p>
* <p>
* Stream marks are intended to be used in
* Stream marks are intended to be used in
...
...
src/share/classes/java/io/RandomAccessFile.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 1994, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -41,16 +41,16 @@ import sun.nio.ch.FileChannelImpl;
...
@@ -41,16 +41,16 @@ import sun.nio.ch.FileChannelImpl;
* the file pointer past the bytes written. Output operations that write
* the file pointer past the bytes written. Output operations that write
* past the current end of the implied array cause the array to be
* past the current end of the implied array cause the array to be
* extended. The file pointer can be read by the
* extended. The file pointer can be read by the
*
<code>getFilePointer</code> method and set by the <code>seek</code>
*
{@code getFilePointer} method and set by the {@code seek}
* method.
* method.
* <p>
* <p>
* It is generally true of all the reading routines in this class that
* It is generally true of all the reading routines in this class that
* if end-of-file is reached before the desired number of bytes has been
* if end-of-file is reached before the desired number of bytes has been
* read, an
<code>EOFException</code>
(which is a kind of
* read, an
{@code EOFException}
(which is a kind of
*
<code>IOException</code>
) is thrown. If any byte cannot be read for
*
{@code IOException}
) is thrown. If any byte cannot be read for
* any reason other than end-of-file, an
<code>IOException</code>
other
* any reason other than end-of-file, an
{@code IOException}
other
* than
<code>EOFException</code>
is thrown. In particular, an
* than
{@code EOFException}
is thrown. In particular, an
*
<code>IOException</code>
may be thrown if the stream has been closed.
*
{@code IOException}
may be thrown if the stream has been closed.
*
*
* @author unascribed
* @author unascribed
* @since JDK1.0
* @since JDK1.0
...
@@ -82,12 +82,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -82,12 +82,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* href="#mode"><tt>RandomAccessFile(File,String)</tt></a> constructor.
* href="#mode"><tt>RandomAccessFile(File,String)</tt></a> constructor.
*
*
* <p>
* <p>
* If there is a security manager, its
<code>checkRead</code>
method
* If there is a security manager, its
{@code checkRead}
method
* is called with the
<code>name</code>
argument
* is called with the
{@code name}
argument
* as its argument to see if read access to the file is allowed.
* as its argument to see if read access to the file is allowed.
* If the mode allows writing, the security manager's
* If the mode allows writing, the security manager's
*
<code>checkWrite</code>
method
*
{@code checkWrite}
method
* is also called with the
<code>name</code>
argument
* is also called with the
{@code name}
argument
* as its argument to see if write access to the file is allowed.
* as its argument to see if write access to the file is allowed.
*
*
* @param name the system-dependent filename
* @param name the system-dependent filename
...
@@ -103,9 +103,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -103,9 +103,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* that name cannot be created, or if some other error occurs
* that name cannot be created, or if some other error occurs
* while opening or creating the file
* while opening or creating the file
* @exception SecurityException if a security manager exists and its
* @exception SecurityException if a security manager exists and its
*
<code>checkRead</code>
method denies read access to the file
*
{@code checkRead}
method denies read access to the file
* or the mode is "rw" and the security manager's
* or the mode is "rw" and the security manager's
*
<code>checkWrite</code>
method denies write access to the file
*
{@code checkWrite}
method denies write access to the file
* @see java.lang.SecurityException
* @see java.lang.SecurityException
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
...
@@ -164,10 +164,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -164,10 +164,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* updates to both the file's content and its metadata to be written, which
* 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.
* generally requires at least one more low-level I/O operation.
*
*
* <p> If there is a security manager, its
<code>checkRead</code>
method is
* <p> If there is a security manager, its
{@code checkRead}
method is
* called with the pathname of the
<code>file</code>
argument as its
* called with the pathname of the
{@code file}
argument as its
* argument to see if read access to the file is allowed. If the mode
* argument to see if read access to the file is allowed. If the mode
* allows writing, the security manager's
<code>checkWrite</code>
method is
* allows writing, the security manager's
{@code checkWrite}
method is
* also called with the path argument to see if write access to the file is
* also called with the path argument to see if write access to the file is
* allowed.
* allowed.
*
*
...
@@ -185,9 +185,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -185,9 +185,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* that name cannot be created, or if some other error occurs
* that name cannot be created, or if some other error occurs
* while opening or creating the file
* while opening or creating the file
* @exception SecurityException if a security manager exists and its
* @exception SecurityException if a security manager exists and its
*
<code>checkRead</code>
method denies read access to the file
*
{@code checkRead}
method denies read access to the file
* or the mode is "rw" and the security manager's
* or the mode is "rw" and the security manager's
*
<code>checkWrite</code>
method denies write access to the file
*
{@code checkWrite}
method denies write access to the file
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
* @see java.nio.channels.FileChannel#force(boolean)
* @see java.nio.channels.FileChannel#force(boolean)
...
@@ -253,7 +253,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -253,7 +253,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* object associated with this file.
* object associated with this file.
*
*
* <p> The {@link java.nio.channels.FileChannel#position()
* <p> The {@link java.nio.channels.FileChannel#position()
*
</code>position<code>
} of the returned channel will always be equal to
*
position
} of the returned channel will always be equal to
* this object's file-pointer offset as returned by the {@link
* this object's file-pointer offset as returned by the {@link
* #getFilePointer getFilePointer} method. Changing this object's
* #getFilePointer getFilePointer} method. Changing this object's
* file-pointer offset, whether explicitly or by reading or writing bytes,
* file-pointer offset, whether explicitly or by reading or writing bytes,
...
@@ -277,9 +277,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -277,9 +277,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
/**
/**
* Opens a file and returns the file descriptor. The file is
* Opens a file and returns the file descriptor. The file is
* opened in read-write mode if the O_RDWR bit in
<code>mode</code>
* opened in read-write mode if the O_RDWR bit in
{@code mode}
* is true, else the file is opened as read-only.
* is true, else the file is opened as read-only.
* If the
<code>name</code>
refers to a directory, an IOException
* If the
{@code name}
refers to a directory, an IOException
* is thrown.
* is thrown.
*
*
* @param name the name of the file
* @param name the name of the file
...
@@ -293,15 +293,15 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -293,15 +293,15 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
/**
/**
* Reads a byte of data from this file. The byte is returned as an
* Reads a byte of data from this file. The byte is returned as an
* integer in the range 0 to 255 (
<code>0x00-0x0ff</code>
). This
* integer in the range 0 to 255 (
{@code 0x00-0x0ff}
). This
* method blocks if no input is yet available.
* method blocks if no input is yet available.
* <p>
* <p>
* Although
<code>RandomAccessFile</code>
is not a subclass of
* Although
{@code RandomAccessFile}
is not a subclass of
*
<code>InputStream</code>
, this method behaves in exactly the same
*
{@code InputStream}
, this method behaves in exactly the same
* way as the {@link InputStream#read()} method of
* way as the {@link InputStream#read()} method of
*
<code>InputStream</code>
.
*
{@code InputStream}
.
*
*
* @return the next byte of data, or
<code>-1</code>
if the end of the
* @return the next byte of data, or
{@code -1}
if the end of the
* file has been reached.
* file has been reached.
* @exception IOException if an I/O error occurs. Not thrown if
* @exception IOException if an I/O error occurs. Not thrown if
* end-of-file has been reached.
* end-of-file has been reached.
...
@@ -318,59 +318,59 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -318,59 +318,59 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
private
native
int
readBytes
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
;
private
native
int
readBytes
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
;
/**
/**
* Reads up to
<code>len</code>
bytes of data from this file into an
* Reads up to
{@code len}
bytes of data from this file into an
* array of bytes. This method blocks until at least one byte of input
* array of bytes. This method blocks until at least one byte of input
* is available.
* is available.
* <p>
* <p>
* Although
<code>RandomAccessFile</code>
is not a subclass of
* Although
{@code RandomAccessFile}
is not a subclass of
*
<code>InputStream</code>
, this method behaves in exactly the
*
{@code InputStream}
, this method behaves in exactly the
* same way as the {@link InputStream#read(byte[], int, int)} method of
* same way as the {@link InputStream#read(byte[], int, int)} method of
*
<code>InputStream</code>
.
*
{@code InputStream}
.
*
*
* @param b the buffer into which the data is read.
* @param b the buffer into which the data is read.
* @param off the start offset in array
<code>b</code>
* @param off the start offset in array
{@code b}
* at which the data is written.
* at which the data is written.
* @param len the maximum number of bytes read.
* @param len the maximum number of bytes read.
* @return the total number of bytes read into the buffer, or
* @return the total number of bytes read into the buffer, or
*
<code>-1</code>
if there is no more data because the end of
*
{@code -1}
if there is no more data because the end of
* the file has been reached.
* the file has been reached.
* @exception IOException If the first byte cannot be read for any reason
* @exception IOException If the first byte cannot be read for any reason
* other than end of file, or if the random access file has been closed, or if
* other than end of file, or if the random access file has been closed, or if
* some other I/O error occurs.
* some other I/O error occurs.
* @exception NullPointerException If
<code>b</code> is <code>null</code>
.
* @exception NullPointerException If
{@code b} is {@code null}
.
* @exception IndexOutOfBoundsException If
<code>off</code>
is negative,
* @exception IndexOutOfBoundsException If
{@code off}
is negative,
*
<code>len</code> is negative, or <code>len</code>
is greater than
*
{@code len} is negative, or {@code len}
is greater than
*
<code>b.length - off</code>
*
{@code b.length - off}
*/
*/
public
int
read
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
{
public
int
read
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
{
return
readBytes
(
b
,
off
,
len
);
return
readBytes
(
b
,
off
,
len
);
}
}
/**
/**
* Reads up to
<code>b.length</code>
bytes of data from this file
* Reads up to
{@code b.length}
bytes of data from this file
* into an array of bytes. This method blocks until at least one byte
* into an array of bytes. This method blocks until at least one byte
* of input is available.
* of input is available.
* <p>
* <p>
* Although
<code>RandomAccessFile</code>
is not a subclass of
* Although
{@code RandomAccessFile}
is not a subclass of
*
<code>InputStream</code>
, this method behaves in exactly the
*
{@code InputStream}
, this method behaves in exactly the
* same way as the {@link InputStream#read(byte[])} method of
* same way as the {@link InputStream#read(byte[])} method of
*
<code>InputStream</code>
.
*
{@code InputStream}
.
*
*
* @param b the buffer into which the data is read.
* @param b the buffer into which the data is read.
* @return the total number of bytes read into the buffer, or
* @return the total number of bytes read into the buffer, or
*
<code>-1</code>
if there is no more data because the end of
*
{@code -1}
if there is no more data because the end of
* this file has been reached.
* this file has been reached.
* @exception IOException If the first byte cannot be read for any reason
* @exception IOException If the first byte cannot be read for any reason
* other than end of file, or if the random access file has been closed, or if
* other than end of file, or if the random access file has been closed, or if
* some other I/O error occurs.
* some other I/O error occurs.
* @exception NullPointerException If
<code>b</code> is <code>null</code>
.
* @exception NullPointerException If
{@code b} is {@code null}
.
*/
*/
public
int
read
(
byte
b
[])
throws
IOException
{
public
int
read
(
byte
b
[])
throws
IOException
{
return
readBytes
(
b
,
0
,
b
.
length
);
return
readBytes
(
b
,
0
,
b
.
length
);
}
}
/**
/**
* Reads
<code>b.length</code>
bytes from this file into the byte
* Reads
{@code b.length}
bytes from this file into the byte
* array, starting at the current file pointer. This method reads
* array, starting at the current file pointer. This method reads
* repeatedly from the file until the requested number of bytes are
* repeatedly from the file until the requested number of bytes are
* read. This method blocks until the requested number of bytes are
* read. This method blocks until the requested number of bytes are
...
@@ -386,7 +386,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -386,7 +386,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Reads exactly
<code>len</code>
bytes from this file into the byte
* Reads exactly
{@code len}
bytes from this file into the byte
* array, starting at the current file pointer. This method reads
* array, starting at the current file pointer. This method reads
* repeatedly from the file until the requested number of bytes are
* repeatedly from the file until the requested number of bytes are
* read. This method blocks until the requested number of bytes are
* read. This method blocks until the requested number of bytes are
...
@@ -410,15 +410,15 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -410,15 +410,15 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Attempts to skip over
<code>n</code>
bytes of input discarding the
* Attempts to skip over
{@code n}
bytes of input discarding the
* skipped bytes.
* skipped bytes.
* <p>
* <p>
*
*
* This method may skip over some smaller number of bytes, possibly zero.
* This method may skip over some smaller number of bytes, possibly zero.
* This may result from any of a number of conditions; reaching end of
* This may result from any of a number of conditions; reaching end of
* file before
<code>n</code>
bytes have been skipped is only one
* file before
{@code n}
bytes have been skipped is only one
* possibility. This method never throws an
<code>EOFException</code>
.
* possibility. This method never throws an
{@code EOFException}
.
* The actual number of bytes skipped is returned. If
<code>n</code>
* The actual number of bytes skipped is returned. If
{@code n}
* is negative, no bytes are skipped.
* is negative, no bytes are skipped.
*
*
* @param n the number of bytes to be skipped.
* @param n the number of bytes to be skipped.
...
@@ -451,7 +451,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -451,7 +451,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* Writes the specified byte to this file. The write starts at
* Writes the specified byte to this file. The write starts at
* the current file pointer.
* the current file pointer.
*
*
* @param b the
<code>byte</code>
to be written.
* @param b the
{@code byte}
to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
public
native
void
write
(
int
b
)
throws
IOException
;
public
native
void
write
(
int
b
)
throws
IOException
;
...
@@ -467,7 +467,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -467,7 +467,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
private
native
void
writeBytes
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
;
private
native
void
writeBytes
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
;
/**
/**
* Writes
<code>b.length</code>
bytes from the specified byte array
* Writes
{@code b.length}
bytes from the specified byte array
* to this file, starting at the current file pointer.
* to this file, starting at the current file pointer.
*
*
* @param b the data.
* @param b the data.
...
@@ -478,8 +478,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -478,8 +478,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Writes
<code>len</code>
bytes from the specified byte array
* Writes
{@code len}
bytes from the specified byte array
* starting at offset
<code>off</code>
to this file.
* starting at offset
{@code off}
to this file.
*
*
* @param b the data.
* @param b the data.
* @param off the start offset in the data.
* @param off the start offset in the data.
...
@@ -512,8 +512,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -512,8 +512,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @param pos the offset position, measured in bytes from the
* @param pos the offset position, measured in bytes from the
* beginning of the file, at which to set the file
* beginning of the file, at which to set the file
* pointer.
* pointer.
* @exception IOException if
<code>pos</code>
is less than
* @exception IOException if
{@code pos}
is less than
*
<code>0</code>
or if an I/O error occurs.
*
{@code 0}
or if an I/O error occurs.
*/
*/
public
native
void
seek
(
long
pos
)
throws
IOException
;
public
native
void
seek
(
long
pos
)
throws
IOException
;
...
@@ -529,14 +529,14 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -529,14 +529,14 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* Sets the length of this file.
* Sets the length of this file.
*
*
* <p> If the present length of the file as returned by the
* <p> If the present length of the file as returned by the
*
<code>length</code> method is greater than the <code>newLength</code>
*
{@code length} method is greater than the {@code newLength}
* argument then the file will be truncated. In this case, if the file
* argument then the file will be truncated. In this case, if the file
* offset as returned by the
<code>getFilePointer</code>
method is greater
* offset as returned by the
{@code getFilePointer}
method is greater
* than
<code>newLength</code>
then after this method returns the offset
* than
{@code newLength}
then after this method returns the offset
* will be equal to
<code>newLength</code>
.
* will be equal to
{@code newLength}
.
*
*
* <p> If the present length of the file as returned by the
* <p> If the present length of the file as returned by the
*
<code>length</code> method is smaller than the <code>newLength</code>
*
{@code length} method is smaller than the {@code newLength}
* argument then the file will be extended. In this case, the contents of
* argument then the file will be extended. In this case, the contents of
* the extended portion of the file are not defined.
* the extended portion of the file are not defined.
*
*
...
@@ -584,14 +584,14 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -584,14 +584,14 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
//
//
/**
/**
* Reads a
<code>boolean</code>
from this file. This method reads a
* Reads a
{@code boolean}
from this file. This method reads a
* single byte from the file, starting at the current file pointer.
* single byte from the file, starting at the current file pointer.
* A value of
<code>0</code>
represents
* A value of
{@code 0}
represents
*
<code>false</code>. Any other value represents <code>true</code>
.
*
{@code false}. Any other value represents {@code true}
.
* This method blocks until the byte is read, the end of the stream
* This method blocks until the byte is read, the end of the stream
* is detected, or an exception is thrown.
* is detected, or an exception is thrown.
*
*
* @return the
<code>boolean</code>
value read.
* @return the
{@code boolean}
value read.
* @exception EOFException if this file has reached the end.
* @exception EOFException if this file has reached the end.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
...
@@ -605,7 +605,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -605,7 +605,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
/**
/**
* Reads a signed eight-bit value from this file. This method reads a
* Reads a signed eight-bit value from this file. This method reads a
* byte from the file, starting from the current file pointer.
* byte from the file, starting from the current file pointer.
* If the byte read is
<code>b</code>
, where
* If the byte read is
{@code b}
, where
* <code>0 <= b <= 255</code>,
* <code>0 <= b <= 255</code>,
* then the result is:
* then the result is:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -616,7 +616,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -616,7 +616,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* is detected, or an exception is thrown.
* is detected, or an exception is thrown.
*
*
* @return the next byte of this file as a signed eight-bit
* @return the next byte of this file as a signed eight-bit
*
<code>byte</code>
.
*
{@code byte}
.
* @exception EOFException if this file has reached the end.
* @exception EOFException if this file has reached the end.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
...
@@ -651,8 +651,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -651,8 +651,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* Reads a signed 16-bit number from this file. The method reads two
* Reads a signed 16-bit number from this file. The method reads two
* bytes from this file, starting at the current file pointer.
* bytes from this file, starting at the current file pointer.
* If the two bytes read, in order, are
* If the two bytes read, in order, are
*
<code>b1</code> and <code>b2</code>
, where each of the two values is
*
{@code b1} and {@code b2}
, where each of the two values is
* between
<code>0</code> and <code>255</code>
, inclusive, then the
* between
{@code 0} and {@code 255}
, inclusive, then the
* result is equal to:
* result is equal to:
* <blockquote><pre>
* <blockquote><pre>
* (short)((b1 << 8) | b2)
* (short)((b1 << 8) | b2)
...
@@ -679,7 +679,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -679,7 +679,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* Reads an unsigned 16-bit number from this file. This method reads
* Reads an unsigned 16-bit number from this file. This method reads
* two bytes from the file, starting at the current file pointer.
* two bytes from the file, starting at the current file pointer.
* If the bytes read, in order, are
* If the bytes read, in order, are
*
<code>b1</code> and <code>b2</code>
, where
*
{@code b1} and {@code b2}
, where
* <code>0 <= b1, b2 <= 255</code>,
* <code>0 <= b1, b2 <= 255</code>,
* then the result is equal to:
* then the result is equal to:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -707,7 +707,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -707,7 +707,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* Reads a character from this file. This method reads two
* Reads a character from this file. This method reads two
* bytes from the file, starting at the current file pointer.
* bytes from the file, starting at the current file pointer.
* If the bytes read, in order, are
* If the bytes read, in order, are
*
<code>b1</code> and <code>b2</code>
, where
*
{@code b1} and {@code b2}
, where
* <code>0 <= b1, b2 <= 255</code>,
* <code>0 <= b1, b2 <= 255</code>,
* then the result is equal to:
* then the result is equal to:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -718,7 +718,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -718,7 +718,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* stream is detected, or an exception is thrown.
* stream is detected, or an exception is thrown.
*
*
* @return the next two bytes of this file, interpreted as a
* @return the next two bytes of this file, interpreted as a
*
<code>char</code>
.
*
{@code char}
.
* @exception EOFException if this file reaches the end before reading
* @exception EOFException if this file reaches the end before reading
* two bytes.
* two bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -734,8 +734,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -734,8 +734,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
/**
/**
* Reads a signed 32-bit integer from this file. This method reads 4
* Reads a signed 32-bit integer from this file. This method reads 4
* bytes from the file, starting at the current file pointer.
* bytes from the file, starting at the current file pointer.
* If the bytes read, in order, are
<code>b1</code>
,
* If the bytes read, in order, are
{@code b1}
,
*
<code>b2</code>, <code>b3</code>, and <code>b4</code>
, where
*
{@code b2}, {@code b3}, and {@code b4}
, where
* <code>0 <= b1, b2, b3, b4 <= 255</code>,
* <code>0 <= b1, b2, b3, b4 <= 255</code>,
* then the result is equal to:
* then the result is equal to:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -746,7 +746,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -746,7 +746,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* stream is detected, or an exception is thrown.
* stream is detected, or an exception is thrown.
*
*
* @return the next four bytes of this file, interpreted as an
* @return the next four bytes of this file, interpreted as an
*
<code>int</code>
.
*
{@code int}
.
* @exception EOFException if this file reaches the end before reading
* @exception EOFException if this file reaches the end before reading
* four bytes.
* four bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -765,9 +765,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -765,9 +765,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* Reads a signed 64-bit integer from this file. This method reads eight
* Reads a signed 64-bit integer from this file. This method reads eight
* bytes from the file, starting at the current file pointer.
* bytes from the file, starting at the current file pointer.
* If the bytes read, in order, are
* If the bytes read, in order, are
*
<code>b1</code>, <code>b2</code>, <code>b3</code>
,
*
{@code b1}, {@code b2}, {@code b3}
,
*
<code>b4</code>, <code>b5</code>, <code>b6</code>
,
*
{@code b4}, {@code b5}, {@code b6}
,
*
<code>b7</code>, and <code>b8,</code>
where:
*
{@code b7}, and {@code b8,}
where:
* <blockquote><pre>
* <blockquote><pre>
* 0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
* 0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
* </pre></blockquote>
* </pre></blockquote>
...
@@ -784,7 +784,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -784,7 +784,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* stream is detected, or an exception is thrown.
* stream is detected, or an exception is thrown.
*
*
* @return the next eight bytes of this file, interpreted as a
* @return the next eight bytes of this file, interpreted as a
*
<code>long</code>
.
*
{@code long}
.
* @exception EOFException if this file reaches the end before reading
* @exception EOFException if this file reaches the end before reading
* eight bytes.
* eight bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -794,18 +794,18 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -794,18 +794,18 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Reads a
<code>float</code>
from this file. This method reads an
* Reads a
{@code float}
from this file. This method reads an
*
<code>int</code>
value, starting at the current file pointer,
*
{@code int}
value, starting at the current file pointer,
* as if by the
<code>readInt</code>
method
* as if by the
{@code readInt}
method
* and then converts that
<code>int</code> to a <code>float</code>
* and then converts that
{@code int} to a {@code float}
* using the
<code>intBitsToFloat</code>
method in class
* using the
{@code intBitsToFloat}
method in class
*
<code>Float</code>
.
*
{@code Float}
.
* <p>
* <p>
* This method blocks until the four bytes are read, the end of the
* This method blocks until the four bytes are read, the end of the
* stream is detected, or an exception is thrown.
* stream is detected, or an exception is thrown.
*
*
* @return the next four bytes of this file, interpreted as a
* @return the next four bytes of this file, interpreted as a
*
<code>float</code>
.
*
{@code float}
.
* @exception EOFException if this file reaches the end before reading
* @exception EOFException if this file reaches the end before reading
* four bytes.
* four bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -817,18 +817,18 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -817,18 +817,18 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Reads a
<code>double</code>
from this file. This method reads a
* Reads a
{@code double}
from this file. This method reads a
*
<code>long</code>
value, starting at the current file pointer,
*
{@code long}
value, starting at the current file pointer,
* as if by the
<code>readLong</code>
method
* as if by the
{@code readLong}
method
* and then converts that
<code>long</code> to a <code>double</code>
* and then converts that
{@code long} to a {@code double}
* using the
<code>longBitsToDouble</code>
method in
* using the
{@code longBitsToDouble}
method in
* class
<code>Double</code>
.
* class
{@code Double}
.
* <p>
* <p>
* This method blocks until the eight bytes are read, the end of the
* This method blocks until the eight bytes are read, the end of the
* stream is detected, or an exception is thrown.
* stream is detected, or an exception is thrown.
*
*
* @return the next eight bytes of this file, interpreted as a
* @return the next eight bytes of this file, interpreted as a
*
<code>double</code>
.
*
{@code double}
.
* @exception EOFException if this file reaches the end before reading
* @exception EOFException if this file reaches the end before reading
* eight bytes.
* eight bytes.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
...
@@ -849,7 +849,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -849,7 +849,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* therefore, support the full Unicode character set.
* therefore, support the full Unicode character set.
*
*
* <p> A line of text is terminated by a carriage-return character
* <p> A line of text is terminated by a carriage-return character
* (
<code>'\r'</code>), a newline character (<code>'\n'</code>
), a
* (
{@code '\u005Cr'}), a newline character ({@code '\u005Cn'}
), a
* carriage-return character immediately followed by a newline character,
* carriage-return character immediately followed by a newline character,
* or the end of the file. Line-terminating characters are discarded and
* or the end of the file. Line-terminating characters are discarded and
* are not included as part of the string returned.
* are not included as part of the string returned.
...
@@ -901,7 +901,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -901,7 +901,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* <p>
* <p>
* The first two bytes are read, starting from the current file
* The first two bytes are read, starting from the current file
* pointer, as if by
* pointer, as if by
*
<code>readUnsignedShort</code>
. This value gives the number of
*
{@code readUnsignedShort}
. This value gives the number of
* following bytes that are in the encoded string, not
* following bytes that are in the encoded string, not
* the length of the resulting string. The following bytes are then
* the length of the resulting string. The following bytes are then
* interpreted as bytes encoding characters in the modified UTF-8 format
* interpreted as bytes encoding characters in the modified UTF-8 format
...
@@ -923,13 +923,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -923,13 +923,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Writes a
<code>boolean</code>
to the file as a one-byte value. The
* Writes a
{@code boolean}
to the file as a one-byte value. The
* value
<code>true</code>
is written out as the value
* value
{@code true}
is written out as the value
*
<code>(byte)1</code>; the value <code>false</code>
is written out
*
{@code (byte)1}; the value {@code false}
is written out
* as the value
<code>(byte)0</code>
. The write starts at
* as the value
{@code (byte)0}
. The write starts at
* the current position of the file pointer.
* the current position of the file pointer.
*
*
* @param v a
<code>boolean</code>
value to be written.
* @param v a
{@code boolean}
value to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
public
final
void
writeBoolean
(
boolean
v
)
throws
IOException
{
public
final
void
writeBoolean
(
boolean
v
)
throws
IOException
{
...
@@ -938,10 +938,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -938,10 +938,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Writes a
<code>byte</code>
to the file as a one-byte value. The
* Writes a
{@code byte}
to the file as a one-byte value. The
* write starts at the current position of the file pointer.
* write starts at the current position of the file pointer.
*
*
* @param v a
<code>byte</code>
value to be written.
* @param v a
{@code byte}
value to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
public
final
void
writeByte
(
int
v
)
throws
IOException
{
public
final
void
writeByte
(
int
v
)
throws
IOException
{
...
@@ -950,10 +950,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -950,10 +950,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Writes a
<code>short</code>
to the file as two bytes, high byte first.
* Writes a
{@code short}
to the file as two bytes, high byte first.
* The write starts at the current position of the file pointer.
* The write starts at the current position of the file pointer.
*
*
* @param v a
<code>short</code>
to be written.
* @param v a
{@code short}
to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
public
final
void
writeShort
(
int
v
)
throws
IOException
{
public
final
void
writeShort
(
int
v
)
throws
IOException
{
...
@@ -963,11 +963,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -963,11 +963,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Writes a
<code>char</code>
to the file as a two-byte value, high
* Writes a
{@code char}
to the file as a two-byte value, high
* byte first. The write starts at the current position of the
* byte first. The write starts at the current position of the
* file pointer.
* file pointer.
*
*
* @param v a
<code>char</code>
value to be written.
* @param v a
{@code char}
value to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
public
final
void
writeChar
(
int
v
)
throws
IOException
{
public
final
void
writeChar
(
int
v
)
throws
IOException
{
...
@@ -977,10 +977,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -977,10 +977,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Writes an
<code>int</code>
to the file as four bytes, high byte first.
* Writes an
{@code int}
to the file as four bytes, high byte first.
* The write starts at the current position of the file pointer.
* The write starts at the current position of the file pointer.
*
*
* @param v an
<code>int</code>
to be written.
* @param v an
{@code int}
to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
public
final
void
writeInt
(
int
v
)
throws
IOException
{
public
final
void
writeInt
(
int
v
)
throws
IOException
{
...
@@ -992,10 +992,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -992,10 +992,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Writes a
<code>long</code>
to the file as eight bytes, high byte first.
* Writes a
{@code long}
to the file as eight bytes, high byte first.
* The write starts at the current position of the file pointer.
* The write starts at the current position of the file pointer.
*
*
* @param v a
<code>long</code>
to be written.
* @param v a
{@code long}
to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
*/
*/
public
final
void
writeLong
(
long
v
)
throws
IOException
{
public
final
void
writeLong
(
long
v
)
throws
IOException
{
...
@@ -1011,13 +1011,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -1011,13 +1011,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Converts the float argument to an
<code>int</code>
using the
* Converts the float argument to an
{@code int}
using the
*
<code>floatToIntBits</code> method in class <code>Float</code>
,
*
{@code floatToIntBits} method in class {@code Float}
,
* and then writes that
<code>int</code>
value to the file as a
* and then writes that
{@code int}
value to the file as a
* four-byte quantity, high byte first. The write starts at the
* four-byte quantity, high byte first. The write starts at the
* current position of the file pointer.
* current position of the file pointer.
*
*
* @param v a
<code>float</code>
value to be written.
* @param v a
{@code float}
value to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
* @see java.lang.Float#floatToIntBits(float)
* @see java.lang.Float#floatToIntBits(float)
*/
*/
...
@@ -1026,13 +1026,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -1026,13 +1026,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
}
/**
/**
* Converts the double argument to a
<code>long</code>
using the
* Converts the double argument to a
{@code long}
using the
*
<code>doubleToLongBits</code> method in class <code>Double</code>
,
*
{@code doubleToLongBits} method in class {@code Double}
,
* and then writes that
<code>long</code>
value to the file as an
* and then writes that
{@code long}
value to the file as an
* eight-byte quantity, high byte first. The write starts at the current
* eight-byte quantity, high byte first. The write starts at the current
* position of the file pointer.
* position of the file pointer.
*
*
* @param v a
<code>double</code>
value to be written.
* @param v a
{@code double}
value to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
* @see java.lang.Double#doubleToLongBits(double)
* @see java.lang.Double#doubleToLongBits(double)
*/
*/
...
@@ -1060,10 +1060,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -1060,10 +1060,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
/**
/**
* Writes a string to the file as a sequence of characters. Each
* Writes a string to the file as a sequence of characters. Each
* character is written to the data output stream as if by the
* character is written to the data output stream as if by the
*
<code>writeChar</code>
method. The write starts at the current
*
{@code writeChar}
method. The write starts at the current
* position of the file pointer.
* position of the file pointer.
*
*
* @param s a
<code>String</code>
value to be written.
* @param s a
{@code String}
value to be written.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
* @see java.io.RandomAccessFile#writeChar(int)
* @see java.io.RandomAccessFile#writeChar(int)
*/
*/
...
@@ -1087,7 +1087,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
...
@@ -1087,7 +1087,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* <p>
* <p>
* First, two bytes are written to the file, starting at the
* First, two bytes are written to the file, starting at the
* current file pointer, as if by the
* current file pointer, as if by the
*
<code>writeShort</code>
method giving the number of bytes to
*
{@code writeShort}
method giving the number of bytes to
* follow. This value is the number of bytes actually written out,
* follow. This value is the number of bytes actually written out,
* not the length of the string. Following the length, each character
* not the length of the string. Following the length, each character
* of the string is output, in sequence, using the modified UTF-8 encoding
* of the string is output, in sequence, using the modified UTF-8 encoding
...
...
src/share/classes/java/io/StreamTokenizer.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 1995, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 20
12
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -28,7 +28,7 @@ package java.io;
...
@@ -28,7 +28,7 @@ package java.io;
import
java.util.Arrays
;
import
java.util.Arrays
;
/**
/**
* The
<code>StreamTokenizer</code>
class takes an input stream and
* The
{@code StreamTokenizer}
class takes an input stream and
* parses it into "tokens", allowing the tokens to be
* parses it into "tokens", allowing the tokens to be
* read one at a time. The parsing process is controlled by a table
* read one at a time. The parsing process is controlled by a table
* and a number of flags that can be set to various states. The
* and a number of flags that can be set to various states. The
...
@@ -36,7 +36,7 @@ import java.util.Arrays;
...
@@ -36,7 +36,7 @@ import java.util.Arrays;
* strings, and various comment styles.
* strings, and various comment styles.
* <p>
* <p>
* Each byte read from the input stream is regarded as a character
* Each byte read from the input stream is regarded as a character
* in the range
<code>'\u0000'</code> through <code>'\u00FF'</code>
.
* in the range
{@code '\u005Cu0000'} through {@code '\u005Cu00FF'}
.
* The character value is used to look up five possible attributes of
* The character value is used to look up five possible attributes of
* the character: <i>white space</i>, <i>alphabetic</i>,
* the character: <i>white space</i>, <i>alphabetic</i>,
* <i>numeric</i>, <i>string quote</i>, and <i>comment character</i>.
* <i>numeric</i>, <i>string quote</i>, and <i>comment character</i>.
...
@@ -53,8 +53,8 @@ import java.util.Arrays;
...
@@ -53,8 +53,8 @@ import java.util.Arrays;
* <p>
* <p>
* A typical application first constructs an instance of this class,
* A typical application first constructs an instance of this class,
* sets up the syntax tables, and then repeatedly loops calling the
* sets up the syntax tables, and then repeatedly loops calling the
*
<code>nextToken</code>
method in each iteration of the loop until
*
{@code nextToken}
method in each iteration of the loop until
* it returns the value
<code>TT_EOF</code>
.
* it returns the value
{@code TT_EOF}
.
*
*
* @author James Gosling
* @author James Gosling
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#nextToken()
...
@@ -99,19 +99,19 @@ public class StreamTokenizer {
...
@@ -99,19 +99,19 @@ public class StreamTokenizer {
private
static
final
byte
CT_COMMENT
=
16
;
private
static
final
byte
CT_COMMENT
=
16
;
/**
/**
* After a call to the
<code>nextToken</code>
method, this field
* After a call to the
{@code nextToken}
method, this field
* contains the type of the token just read. For a single character
* contains the type of the token just read. For a single character
* token, its value is the single character, converted to an integer.
* token, its value is the single character, converted to an integer.
* For a quoted string token, its value is the quote character.
* For a quoted string token, its value is the quote character.
* Otherwise, its value is one of the following:
* Otherwise, its value is one of the following:
* <ul>
* <ul>
* <li>
<code>TT_WORD</code>
indicates that the token is a word.
* <li>
{@code TT_WORD}
indicates that the token is a word.
* <li>
<code>TT_NUMBER</code>
indicates that the token is a number.
* <li>
{@code TT_NUMBER}
indicates that the token is a number.
* <li>
<code>TT_EOL</code>
indicates that the end of line has been read.
* <li>
{@code TT_EOL}
indicates that the end of line has been read.
* The field can only have this value if the
* The field can only have this value if the
*
<code>eolIsSignificant</code>
method has been called with the
*
{@code eolIsSignificant}
method has been called with the
* argument
<code>true</code>
.
* argument
{@code true}
.
* <li>
<code>TT_EOF</code>
indicates that the end of the input stream
* <li>
{@code TT_EOF}
indicates that the end of the input stream
* has been reached.
* has been reached.
* </ul>
* </ul>
* <p>
* <p>
...
@@ -160,8 +160,8 @@ public class StreamTokenizer {
...
@@ -160,8 +160,8 @@ public class StreamTokenizer {
* the string.
* the string.
* <p>
* <p>
* The current token is a word when the value of the
* The current token is a word when the value of the
*
<code>ttype</code> field is <code>TT_WORD</code>
. The current token is
*
{@code ttype} field is {@code TT_WORD}
. The current token is
* a quoted string token when the value of the
<code>ttype</code>
field is
* a quoted string token when the value of the
{@code ttype}
field is
* a quote character.
* a quote character.
* <p>
* <p>
* The initial value of this field is null.
* The initial value of this field is null.
...
@@ -175,7 +175,7 @@ public class StreamTokenizer {
...
@@ -175,7 +175,7 @@ public class StreamTokenizer {
/**
/**
* If the current token is a number, this field contains the value
* If the current token is a number, this field contains the value
* of that number. The current token is a number when the value of
* of that number. The current token is a number when the value of
* the
<code>ttype</code> field is <code>TT_NUMBER</code>
.
* the
{@code ttype} field is {@code TT_NUMBER}
.
* <p>
* <p>
* The initial value of this field is 0.0.
* The initial value of this field is 0.0.
*
*
...
@@ -201,14 +201,14 @@ public class StreamTokenizer {
...
@@ -201,14 +201,14 @@ public class StreamTokenizer {
* stream. The stream tokenizer is initialized to the following
* stream. The stream tokenizer is initialized to the following
* default state:
* default state:
* <ul>
* <ul>
* <li>All byte values
<code>'A'</code> through <code>'Z'</code>
,
* <li>All byte values
{@code 'A'} through {@code 'Z'}
,
*
<code>'a'</code> through <code>'z'</code>
, and
*
{@code 'a'} through {@code 'z'}
, and
*
<code>'\u00A0'</code> through <code>'\u00FF'</code>
are
*
{@code '\u005Cu00A0'} through {@code '\u005Cu00FF'}
are
* considered to be alphabetic.
* considered to be alphabetic.
* <li>All byte values
<code>'\u0000'</code>
through
* <li>All byte values
{@code '\u005Cu0000'}
through
*
<code>'\u0020'</code>
are considered to be white space.
*
{@code '\u005Cu0020'}
are considered to be white space.
* <li>
<code>'/'</code>
is a comment character.
* <li>
{@code '/'}
is a comment character.
* <li>Single quote
<code>'\''</code> and double quote <code>'"'</code>
* <li>Single quote
{@code '\u005C''} and double quote {@code '"'}
* are string quote characters.
* are string quote characters.
* <li>Numbers are parsed.
* <li>Numbers are parsed.
* <li>Ends of lines are treated as white space, not as separate tokens.
* <li>Ends of lines are treated as white space, not as separate tokens.
...
@@ -252,7 +252,7 @@ public class StreamTokenizer {
...
@@ -252,7 +252,7 @@ public class StreamTokenizer {
/**
/**
* Resets this tokenizer's syntax table so that all characters are
* Resets this tokenizer's syntax table so that all characters are
* "ordinary." See the
<code>ordinaryChar</code>
method
* "ordinary." See the
{@code ordinaryChar}
method
* for more information on a character being ordinary.
* for more information on a character being ordinary.
*
*
* @see java.io.StreamTokenizer#ordinaryChar(int)
* @see java.io.StreamTokenizer#ordinaryChar(int)
...
@@ -305,7 +305,7 @@ public class StreamTokenizer {
...
@@ -305,7 +305,7 @@ public class StreamTokenizer {
* Specifies that all characters <i>c</i> in the range
* Specifies that all characters <i>c</i> in the range
* <code>low <= <i>c</i> <= high</code>
* <code>low <= <i>c</i> <= high</code>
* are "ordinary" in this tokenizer. See the
* are "ordinary" in this tokenizer. See the
*
<code>ordinaryChar</code>
method for more information on a
*
{@code ordinaryChar}
method for more information on a
* character being ordinary.
* character being ordinary.
*
*
* @param low the low end of the range.
* @param low the low end of the range.
...
@@ -327,12 +327,12 @@ public class StreamTokenizer {
...
@@ -327,12 +327,12 @@ public class StreamTokenizer {
* character has as a comment character, word component, string
* character has as a comment character, word component, string
* delimiter, white space, or number character. When such a character
* delimiter, white space, or number character. When such a character
* is encountered by the parser, the parser treats it as a
* is encountered by the parser, the parser treats it as a
* single-character token and sets
<code>ttype</code>
field to the
* single-character token and sets
{@code ttype}
field to the
* character value.
* character value.
*
*
* <p>Making a line terminator character "ordinary" may interfere
* <p>Making a line terminator character "ordinary" may interfere
* with the ability of a
<code>StreamTokenizer</code>
to count
* with the ability of a
{@code StreamTokenizer}
to count
* lines. The
<code>lineno</code>
method may no longer reflect
* lines. The
{@code lineno}
method may no longer reflect
* the presence of such terminator characters in its line count.
* the presence of such terminator characters in its line count.
*
*
* @param ch the character.
* @param ch the character.
...
@@ -361,9 +361,9 @@ public class StreamTokenizer {
...
@@ -361,9 +361,9 @@ public class StreamTokenizer {
* Specifies that matching pairs of this character delimit string
* Specifies that matching pairs of this character delimit string
* constants in this tokenizer.
* constants in this tokenizer.
* <p>
* <p>
* When the
<code>nextToken</code>
method encounters a string
* When the
{@code nextToken}
method encounters a string
* constant, the
<code>ttype</code>
field is set to the string
* constant, the
{@code ttype}
field is set to the string
* delimiter and the
<code>sval</code>
field is set to the body of
* delimiter and the
{@code sval}
field is set to the body of
* the string.
* the string.
* <p>
* <p>
* If a string quote character is encountered, then a string is
* If a string quote character is encountered, then a string is
...
@@ -371,7 +371,7 @@ public class StreamTokenizer {
...
@@ -371,7 +371,7 @@ public class StreamTokenizer {
* the string quote character, up to (but not including) the next
* the string quote character, up to (but not including) the next
* occurrence of that same string quote character, or a line
* occurrence of that same string quote character, or a line
* terminator, or end of file. The usual escape sequences such as
* terminator, or end of file. The usual escape sequences such as
*
<code>"\n"</code> and <code>"\t"</code>
are recognized and
*
{@code "\u005Cn"} and {@code "\u005Ct"}
are recognized and
* converted to single characters as the string is parsed.
* converted to single characters as the string is parsed.
*
*
* <p>Any other attribute settings for the specified character are cleared.
* <p>Any other attribute settings for the specified character are cleared.
...
@@ -398,9 +398,9 @@ public class StreamTokenizer {
...
@@ -398,9 +398,9 @@ public class StreamTokenizer {
* <p>
* <p>
* When the parser encounters a word token that has the format of a
* When the parser encounters a word token that has the format of a
* double precision floating-point number, it treats the token as a
* double precision floating-point number, it treats the token as a
* number rather than a word, by setting the
<code>ttype</code>
* number rather than a word, by setting the
{@code ttype}
* field to the value
<code>TT_NUMBER</code>
and putting the numeric
* field to the value
{@code TT_NUMBER}
and putting the numeric
* value of the token into the
<code>nval</code>
field.
* value of the token into the
{@code nval}
field.
*
*
* @see java.io.StreamTokenizer#nval
* @see java.io.StreamTokenizer#nval
* @see java.io.StreamTokenizer#TT_NUMBER
* @see java.io.StreamTokenizer#TT_NUMBER
...
@@ -416,21 +416,21 @@ public class StreamTokenizer {
...
@@ -416,21 +416,21 @@ public class StreamTokenizer {
/**
/**
* Determines whether or not ends of line are treated as tokens.
* Determines whether or not ends of line are treated as tokens.
* If the flag argument is true, this tokenizer treats end of lines
* If the flag argument is true, this tokenizer treats end of lines
* as tokens; the
<code>nextToken</code>
method returns
* as tokens; the
{@code nextToken}
method returns
*
<code>TT_EOL</code> and also sets the <code>ttype</code>
field to
*
{@code TT_EOL} and also sets the {@code ttype}
field to
* this value when an end of line is read.
* this value when an end of line is read.
* <p>
* <p>
* A line is a sequence of characters ending with either a
* A line is a sequence of characters ending with either a
* carriage-return character (
<code>'\r'</code>
) or a newline
* carriage-return character (
{@code '\u005Cr'}
) or a newline
* character (
<code>'\n'</code>
). In addition, a carriage-return
* character (
{@code '\u005Cn'}
). In addition, a carriage-return
* character followed immediately by a newline character is treated
* character followed immediately by a newline character is treated
* as a single end-of-line token.
* as a single end-of-line token.
* <p>
* <p>
* If the
<code>flag</code>
is false, end-of-line characters are
* If the
{@code flag}
is false, end-of-line characters are
* treated as white space and serve only to separate tokens.
* treated as white space and serve only to separate tokens.
*
*
* @param flag
<code>true</code>
indicates that end-of-line characters
* @param flag
{@code true}
indicates that end-of-line characters
* are separate tokens;
<code>false</code>
indicates that
* are separate tokens;
{@code false}
indicates that
* end-of-line characters are white space.
* end-of-line characters are white space.
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#ttype
* @see java.io.StreamTokenizer#ttype
...
@@ -442,14 +442,14 @@ public class StreamTokenizer {
...
@@ -442,14 +442,14 @@ public class StreamTokenizer {
/**
/**
* Determines whether or not the tokenizer recognizes C-style comments.
* Determines whether or not the tokenizer recognizes C-style comments.
* If the flag argument is
<code>true</code>
, this stream tokenizer
* If the flag argument is
{@code true}
, this stream tokenizer
* recognizes C-style comments. All text between successive
* recognizes C-style comments. All text between successive
* occurrences of
<code>/*</code>
and <code>*/</code> are discarded.
* occurrences of
{@code /*}
and <code>*/</code> are discarded.
* <p>
* <p>
* If the flag argument is
<code>false</code>
, then C-style comments
* If the flag argument is
{@code false}
, then C-style comments
* are not treated specially.
* are not treated specially.
*
*
* @param flag
<code>true</code>
indicates to recognize and ignore
* @param flag
{@code true}
indicates to recognize and ignore
* C-style comments.
* C-style comments.
*/
*/
public
void
slashStarComments
(
boolean
flag
)
{
public
void
slashStarComments
(
boolean
flag
)
{
...
@@ -458,15 +458,15 @@ public class StreamTokenizer {
...
@@ -458,15 +458,15 @@ public class StreamTokenizer {
/**
/**
* Determines whether or not the tokenizer recognizes C++-style comments.
* Determines whether or not the tokenizer recognizes C++-style comments.
* If the flag argument is
<code>true</code>
, this stream tokenizer
* If the flag argument is
{@code true}
, this stream tokenizer
* recognizes C++-style comments. Any occurrence of two consecutive
* recognizes C++-style comments. Any occurrence of two consecutive
* slash characters (
<code>'/'</code>
) is treated as the beginning of
* slash characters (
{@code '/'}
) is treated as the beginning of
* a comment that extends to the end of the line.
* a comment that extends to the end of the line.
* <p>
* <p>
* If the flag argument is
<code>false</code>
, then C++-style
* If the flag argument is
{@code false}
, then C++-style
* comments are not treated specially.
* comments are not treated specially.
*
*
* @param flag
<code>true</code>
indicates to recognize and ignore
* @param flag
{@code true}
indicates to recognize and ignore
* C++-style comments.
* C++-style comments.
*/
*/
public
void
slashSlashComments
(
boolean
flag
)
{
public
void
slashSlashComments
(
boolean
flag
)
{
...
@@ -475,16 +475,16 @@ public class StreamTokenizer {
...
@@ -475,16 +475,16 @@ public class StreamTokenizer {
/**
/**
* Determines whether or not word token are automatically lowercased.
* Determines whether or not word token are automatically lowercased.
* If the flag argument is
<code>true</code>
, then the value in the
* If the flag argument is
{@code true}
, then the value in the
*
<code>sval</code>
field is lowercased whenever a word token is
*
{@code sval}
field is lowercased whenever a word token is
* returned (the
<code>ttype</code>
field has the
* returned (the
{@code ttype}
field has the
* value
<code>TT_WORD</code> by the <code>nextToken</code>
method
* value
{@code TT_WORD} by the {@code nextToken}
method
* of this tokenizer.
* of this tokenizer.
* <p>
* <p>
* If the flag argument is
<code>false</code>
, then the
* If the flag argument is
{@code false}
, then the
*
<code>sval</code>
field is not modified.
*
{@code sval}
field is not modified.
*
*
* @param fl
<code>true</code>
indicates that all word tokens should
* @param fl
{@code true}
indicates that all word tokens should
* be lowercased.
* be lowercased.
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#ttype
* @see java.io.StreamTokenizer#ttype
...
@@ -506,9 +506,9 @@ public class StreamTokenizer {
...
@@ -506,9 +506,9 @@ public class StreamTokenizer {
/**
/**
* Parses the next token from the input stream of this tokenizer.
* Parses the next token from the input stream of this tokenizer.
* The type of the next token is returned in the
<code>ttype</code>
* The type of the next token is returned in the
{@code ttype}
* field. Additional information about the token may be in the
* field. Additional information about the token may be in the
*
<code>nval</code> field or the <code>sval</code>
field of this
*
{@code nval} field or the {@code sval}
field of this
* tokenizer.
* tokenizer.
* <p>
* <p>
* Typical clients of this
* Typical clients of this
...
@@ -516,7 +516,7 @@ public class StreamTokenizer {
...
@@ -516,7 +516,7 @@ public class StreamTokenizer {
* calling nextToken to parse successive tokens until TT_EOF
* calling nextToken to parse successive tokens until TT_EOF
* is returned.
* is returned.
*
*
* @return the value of the
<code>ttype</code>
field.
* @return the value of the
{@code ttype}
field.
* @exception IOException if an I/O error occurs.
* @exception IOException if an I/O error occurs.
* @see java.io.StreamTokenizer#nval
* @see java.io.StreamTokenizer#nval
* @see java.io.StreamTokenizer#sval
* @see java.io.StreamTokenizer#sval
...
@@ -752,10 +752,10 @@ public class StreamTokenizer {
...
@@ -752,10 +752,10 @@ public class StreamTokenizer {
}
}
/**
/**
* Causes the next call to the
<code>nextToken</code>
method of this
* Causes the next call to the
{@code nextToken}
method of this
* tokenizer to return the current value in the
<code>ttype</code>
* tokenizer to return the current value in the
{@code ttype}
* field, and not to modify the value in the
<code>nval</code>
or
* field, and not to modify the value in the
{@code nval}
or
*
<code>sval</code>
field.
*
{@code sval}
field.
*
*
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#nextToken()
* @see java.io.StreamTokenizer#nval
* @see java.io.StreamTokenizer#nval
...
...
src/share/classes/java/lang/AbstractStringBuilder.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 2003, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -91,10 +91,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -91,10 +91,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* array is allocated with greater capacity. The new capacity is the
* array is allocated with greater capacity. The new capacity is the
* larger of:
* larger of:
* <ul>
* <ul>
* <li>The
<code>minimumCapacity</code>
argument.
* <li>The
{@code minimumCapacity}
argument.
* <li>Twice the old capacity, plus
<code>2</code>
.
* <li>Twice the old capacity, plus
{@code 2}
.
* </ul>
* </ul>
* If the
<code>minimumCapacity</code>
argument is nonpositive, this
* If the
{@code minimumCapacity}
argument is nonpositive, this
* method takes no action and simply returns.
* method takes no action and simply returns.
*
*
* @param minimumCapacity the minimum desired capacity.
* @param minimumCapacity the minimum desired capacity.
...
@@ -147,26 +147,26 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -147,26 +147,26 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* Sets the length of the character sequence.
* Sets the length of the character sequence.
* The sequence is changed to a new character sequence
* The sequence is changed to a new character sequence
* whose length is specified by the argument. For every nonnegative
* whose length is specified by the argument. For every nonnegative
* index <i>k</i> less than
<code>newLength</code>
, the character at
* index <i>k</i> less than
{@code newLength}
, the character at
* index <i>k</i> in the new character sequence is the same as the
* index <i>k</i> in the new character sequence is the same as the
* character at index <i>k</i> in the old sequence if <i>k</i> is less
* character at index <i>k</i> in the old sequence if <i>k</i> is less
* than the length of the old character sequence; otherwise, it is the
* than the length of the old character sequence; otherwise, it is the
* null character
<code>'\u0000'</code>
.
* null character
{@code '\u005Cu0000'}
.
*
*
* In other words, if the
<code>newLength</code>
argument is less than
* In other words, if the
{@code newLength}
argument is less than
* the current length, the length is changed to the specified length.
* the current length, the length is changed to the specified length.
* <p>
* <p>
* If the
<code>newLength</code>
argument is greater than or equal
* If the
{@code newLength}
argument is greater than or equal
* to the current length, sufficient null characters
* to the current length, sufficient null characters
* (
<code>'\u0000'</code>
) are appended so that
* (
{@code '\u005Cu0000'}
) are appended so that
* length becomes the
<code>newLength</code>
argument.
* length becomes the
{@code newLength}
argument.
* <p>
* <p>
* The
<code>newLength</code>
argument must be greater than or equal
* The
{@code newLength}
argument must be greater than or equal
* to
<code>0</code>
.
* to
{@code 0}
.
*
*
* @param newLength the new length
* @param newLength the new length
* @throws IndexOutOfBoundsException if the
* @throws IndexOutOfBoundsException if the
*
<code>newLength</code>
argument is negative.
*
{@code newLength}
argument is negative.
*/
*/
public
void
setLength
(
int
newLength
)
{
public
void
setLength
(
int
newLength
)
{
if
(
newLength
<
0
)
if
(
newLength
<
0
)
...
@@ -182,21 +182,21 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -182,21 +182,21 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
}
}
/**
/**
* Returns the
<code>char</code>
value in this sequence at the specified index.
* Returns the
{@code char}
value in this sequence at the specified index.
* The first
<code>char</code> value is at index <code>0</code>
, the next at index
* The first
{@code char} value is at index {@code 0}
, the next at index
*
<code>1</code>
, and so on, as in array indexing.
*
{@code 1}
, and so on, as in array indexing.
* <p>
* <p>
* The index argument must be greater than or equal to
* The index argument must be greater than or equal to
*
<code>0</code>
, and less than the length of this sequence.
*
{@code 0}
, and less than the length of this sequence.
*
*
* <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="Character.html#unicode">surrogate</a>, the surrogate
* <a href="Character.html#unicode">surrogate</a>, the surrogate
* value is returned.
* value is returned.
*
*
* @param index the index of the desired
<code>char</code>
value.
* @param index the index of the desired
{@code char}
value.
* @return the
<code>char</code>
value at the specified index.
* @return the
{@code char}
value at the specified index.
* @throws IndexOutOfBoundsException if
<code>index</code>
is
* @throws IndexOutOfBoundsException if
{@code index}
is
* negative or greater than or equal to
<code>length()</code>
.
* negative or greater than or equal to
{@code length()}
.
*/
*/
public
char
charAt
(
int
index
)
{
public
char
charAt
(
int
index
)
{
if
((
index
<
0
)
||
(
index
>=
count
))
if
((
index
<
0
)
||
(
index
>=
count
))
...
@@ -206,22 +206,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -206,22 +206,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Returns the character (Unicode code point) at the specified
* Returns the character (Unicode code point) at the specified
* index. The index refers to
<code>char</code>
values
* index. The index refers to
{@code char}
values
* (Unicode code units) and ranges from
<code>0</code>
to
* (Unicode code units) and ranges from
{@code 0}
to
* {@link #length()}
<code> - 1</code>
.
* {@link #length()}
{@code - 1}
.
*
*
* <p> If the
<code>char</code>
value specified at the given index
* <p> If the
{@code char}
value specified at the given index
* is in the high-surrogate range, the following index is less
* is in the high-surrogate range, the following index is less
* than the length of this sequence, and the
* than the length of this sequence, and the
*
<code>char</code>
value at the following index is in the
*
{@code char}
value at the following index is in the
* low-surrogate range, then the supplementary code point
* low-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
* corresponding to this surrogate pair is returned. Otherwise,
* the
<code>char</code>
value at the given index is returned.
* the
{@code char}
value at the given index is returned.
*
*
* @param index the index to the
<code>char</code>
values
* @param index the index to the
{@code char}
values
* @return the code point value of the character at the
* @return the code point value of the character at the
*
<code>index</code>
*
{@code index}
* @exception IndexOutOfBoundsException if the
<code>index</code>
* @exception IndexOutOfBoundsException if the
{@code index}
* argument is negative or not less than the length of this
* argument is negative or not less than the length of this
* sequence.
* sequence.
*/
*/
...
@@ -234,22 +234,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -234,22 +234,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Returns the character (Unicode code point) before the specified
* Returns the character (Unicode code point) before the specified
* index. The index refers to
<code>char</code>
values
* index. The index refers to
{@code char}
values
* (Unicode code units) and ranges from
<code>1</code>
to {@link
* (Unicode code units) and ranges from
{@code 1}
to {@link
* #length()}.
* #length()}.
*
*
* <p> If the
<code>char</code> value at <code>(index - 1)</code>
* <p> If the
{@code char} value at {@code (index - 1)}
* is in the low-surrogate range,
<code>(index - 2)</code>
is not
* is in the low-surrogate range,
{@code (index - 2)}
is not
* negative, and the
<code>char</code> value at <code>
(index -
* negative, and the
{@code char} value at {@code
(index -
* 2)
</code>
is in the high-surrogate range, then the
* 2)
}
is in the high-surrogate range, then the
* supplementary code point value of the surrogate pair is
* supplementary code point value of the surrogate pair is
* returned. If the
<code>char</code> value at <code>
index -
* returned. If the
{@code char} value at {@code
index -
* 1
</code>
is an unpaired low-surrogate or a high-surrogate, the
* 1
}
is an unpaired low-surrogate or a high-surrogate, the
* surrogate value is returned.
* surrogate value is returned.
*
*
* @param index the index following the code point that should be returned
* @param index the index following the code point that should be returned
* @return the Unicode code point value before the given index.
* @return the Unicode code point value before the given index.
* @exception IndexOutOfBoundsException if the
<code>index</code>
* @exception IndexOutOfBoundsException if the
{@code index}
* argument is less than 1 or greater than the length
* argument is less than 1 or greater than the length
* of this sequence.
* of this sequence.
*/
*/
...
@@ -264,22 +264,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -264,22 +264,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Returns the number of Unicode code points in the specified text
* Returns the number of Unicode code points in the specified text
* range of this sequence. The text range begins at the specified
* range of this sequence. The text range begins at the specified
*
<code>beginIndex</code> and extends to the <code>char</code>
at
*
{@code beginIndex} and extends to the {@code char}
at
* index
<code>endIndex - 1</code>
. Thus the length (in
* index
{@code endIndex - 1}
. Thus the length (in
*
<code>char</code>
s) of the text range is
*
{@code char}
s) of the text range is
*
<code>endIndex-beginIndex</code>
. Unpaired surrogates within
*
{@code endIndex-beginIndex}
. Unpaired surrogates within
* this sequence count as one code point each.
* this sequence count as one code point each.
*
*
* @param beginIndex the index to the first
<code>char</code>
of
* @param beginIndex the index to the first
{@code char}
of
* the text range.
* the text range.
* @param endIndex the index after the last
<code>char</code>
of
* @param endIndex the index after the last
{@code char}
of
* the text range.
* the text range.
* @return the number of Unicode code points in the specified text
* @return the number of Unicode code points in the specified text
* range
* range
* @exception IndexOutOfBoundsException if the
* @exception IndexOutOfBoundsException if the
*
<code>beginIndex</code> is negative, or <code>endIndex</code>
*
{@code beginIndex} is negative, or {@code endIndex}
* is larger than the length of this sequence, or
* is larger than the length of this sequence, or
*
<code>beginIndex</code> is larger than <code>endIndex</code>
.
*
{@code beginIndex} is larger than {@code endIndex}
.
*/
*/
public
int
codePointCount
(
int
beginIndex
,
int
endIndex
)
{
public
int
codePointCount
(
int
beginIndex
,
int
endIndex
)
{
if
(
beginIndex
<
0
||
endIndex
>
count
||
beginIndex
>
endIndex
)
{
if
(
beginIndex
<
0
||
endIndex
>
count
||
beginIndex
>
endIndex
)
{
...
@@ -290,22 +290,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -290,22 +290,22 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Returns the index within this sequence that is offset from the
* Returns the index within this sequence that is offset from the
* given
<code>index</code> by <code>codePointOffset</code>
code
* given
{@code index} by {@code codePointOffset}
code
* points. Unpaired surrogates within the text range given by
* points. Unpaired surrogates within the text range given by
*
<code>index</code> and <code>codePointOffset</code>
count as
*
{@code index} and {@code codePointOffset}
count as
* one code point each.
* one code point each.
*
*
* @param index the index to be offset
* @param index the index to be offset
* @param codePointOffset the offset in code points
* @param codePointOffset the offset in code points
* @return the index within this sequence
* @return the index within this sequence
* @exception IndexOutOfBoundsException if
<code>index</code>
* @exception IndexOutOfBoundsException if
{@code index}
* is negative or larger then the length of this sequence,
* is negative or larger then the length of this sequence,
* or if
<code>codePointOffset</code>
is positive and the subsequence
* or if
{@code codePointOffset}
is positive and the subsequence
* starting with
<code>index</code>
has fewer than
* starting with
{@code index}
has fewer than
*
<code>codePointOffset</code>
code points,
*
{@code codePointOffset}
code points,
* or if
<code>codePointOffset</code>
is negative and the subsequence
* or if
{@code codePointOffset}
is negative and the subsequence
* before
<code>index</code>
has fewer than the absolute value of
* before
{@code index}
has fewer than the absolute value of
*
<code>codePointOffset</code>
code points.
*
{@code codePointOffset}
code points.
*/
*/
public
int
offsetByCodePoints
(
int
index
,
int
codePointOffset
)
{
public
int
offsetByCodePoints
(
int
index
,
int
codePointOffset
)
{
if
(
index
<
0
||
index
>
count
)
{
if
(
index
<
0
||
index
>
count
)
{
...
@@ -317,12 +317,12 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -317,12 +317,12 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Characters are copied from this sequence into the
* Characters are copied from this sequence into the
* destination character array
<code>dst</code>
. The first character to
* destination character array
{@code dst}
. The first character to
* be copied is at index
<code>srcBegin</code>
; the last character to
* be copied is at index
{@code srcBegin}
; the last character to
* be copied is at index
<code>srcEnd-1</code>
. The total number of
* be copied is at index
{@code srcEnd-1}
. The total number of
* characters to be copied is
<code>srcEnd-srcBegin</code>
. The
* characters to be copied is
{@code srcEnd-srcBegin}
. The
* characters are copied into the subarray of
<code>dst</code>
starting
* characters are copied into the subarray of
{@code dst}
starting
* at index
<code>dstBegin</code>
and ending at index:
* at index
{@code dstBegin}
and ending at index:
* <p><blockquote><pre>
* <p><blockquote><pre>
* dstbegin + (srcEnd-srcBegin) - 1
* dstbegin + (srcEnd-srcBegin) - 1
* </pre></blockquote>
* </pre></blockquote>
...
@@ -330,19 +330,19 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -330,19 +330,19 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* @param srcBegin start copying at this offset.
* @param srcBegin start copying at this offset.
* @param srcEnd stop copying at this offset.
* @param srcEnd stop copying at this offset.
* @param dst the array to copy the data into.
* @param dst the array to copy the data into.
* @param dstBegin offset into
<code>dst</code>
.
* @param dstBegin offset into
{@code dst}
.
* @throws NullPointerException if
<code>dst</code>
is
* @throws NullPointerException if
{@code dst}
is
*
<code>null</code>
.
*
{@code null}
.
* @throws IndexOutOfBoundsException if any of the following is true:
* @throws IndexOutOfBoundsException if any of the following is true:
* <ul>
* <ul>
* <li>
<code>srcBegin</code>
is negative
* <li>
{@code srcBegin}
is negative
* <li>
<code>dstBegin</code>
is negative
* <li>
{@code dstBegin}
is negative
* <li>the
<code>srcBegin</code>
argument is greater than
* <li>the
{@code srcBegin}
argument is greater than
* the
<code>srcEnd</code>
argument.
* the
{@code srcEnd}
argument.
* <li>
<code>srcEnd</code>
is greater than
* <li>
{@code srcEnd}
is greater than
*
<code>this.length()</code>
.
*
{@code this.length()}
.
* <li>
<code>dstBegin+srcEnd-srcBegin</code>
is greater than
* <li>
{@code dstBegin+srcEnd-srcBegin}
is greater than
*
<code>dst.length</code>
*
{@code dst.length}
* </ul>
* </ul>
*/
*/
public
void
getChars
(
int
srcBegin
,
int
srcEnd
,
char
[]
dst
,
int
dstBegin
)
public
void
getChars
(
int
srcBegin
,
int
srcEnd
,
char
[]
dst
,
int
dstBegin
)
...
@@ -357,18 +357,18 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -357,18 +357,18 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
}
}
/**
/**
* The character at the specified index is set to
<code>ch</code>
. This
* The character at the specified index is set to
{@code ch}
. This
* sequence is altered to represent a new character sequence that is
* sequence is altered to represent a new character sequence that is
* identical to the old character sequence, except that it contains the
* identical to the old character sequence, except that it contains the
* character
<code>ch</code> at position <code>index</code>
.
* character
{@code ch} at position {@code index}
.
* <p>
* <p>
* The index argument must be greater than or equal to
* The index argument must be greater than or equal to
*
<code>0</code>
, and less than the length of this sequence.
*
{@code 0}
, and less than the length of this sequence.
*
*
* @param index the index of the character to modify.
* @param index the index of the character to modify.
* @param ch the new character.
* @param ch the new character.
* @throws IndexOutOfBoundsException if
<code>index</code>
is
* @throws IndexOutOfBoundsException if
{@code index}
is
* negative or greater than or equal to
<code>length()</code>
.
* negative or greater than or equal to
{@code length()}
.
*/
*/
public
void
setCharAt
(
int
index
,
char
ch
)
{
public
void
setCharAt
(
int
index
,
char
ch
)
{
if
((
index
<
0
)
||
(
index
>=
count
))
if
((
index
<
0
)
||
(
index
>=
count
))
...
@@ -741,21 +741,21 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -741,21 +741,21 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
}
}
/**
/**
* Removes the
<code>char</code>
at the specified position in this
* Removes the
{@code char}
at the specified position in this
* sequence. This sequence is shortened by one
<code>char</code>
.
* sequence. This sequence is shortened by one
{@code char}
.
*
*
* <p>Note: If the character at the given index is a supplementary
* <p>Note: If the character at the given index is a supplementary
* character, this method does not remove the entire character. If
* character, this method does not remove the entire character. If
* correct handling of supplementary characters is required,
* correct handling of supplementary characters is required,
* determine the number of
<code>char</code>
s to remove by calling
* determine the number of
{@code char}
s to remove by calling
*
<code>Character.charCount(thisSequence.codePointAt(index))</code>
,
*
{@code Character.charCount(thisSequence.codePointAt(index))}
,
* where
<code>thisSequence</code>
is this sequence.
* where
{@code thisSequence}
is this sequence.
*
*
* @param index Index of
<code>char</code>
to remove
* @param index Index of
{@code char}
to remove
* @return This object.
* @return This object.
* @throws StringIndexOutOfBoundsException if the
<code>index</code>
* @throws StringIndexOutOfBoundsException if the
{@code index}
* is negative or greater than or equal to
* is negative or greater than or equal to
*
<code>length()</code>
.
*
{@code length()}
.
*/
*/
public
AbstractStringBuilder
deleteCharAt
(
int
index
)
{
public
AbstractStringBuilder
deleteCharAt
(
int
index
)
{
if
((
index
<
0
)
||
(
index
>=
count
))
if
((
index
<
0
)
||
(
index
>=
count
))
...
@@ -767,12 +767,12 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -767,12 +767,12 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Replaces the characters in a substring of this sequence
* Replaces the characters in a substring of this sequence
* with characters in the specified
<code>String</code>
. The substring
* with characters in the specified
{@code String}
. The substring
* begins at the specified
<code>start</code>
and extends to the character
* begins at the specified
{@code start}
and extends to the character
* at index
<code>end - 1</code>
or to the end of the
* at index
{@code end - 1}
or to the end of the
* sequence if no such character exists. First the
* sequence if no such character exists. First the
* characters in the substring are removed and then the specified
* characters in the substring are removed and then the specified
*
<code>String</code> is inserted at <code>start</code>
. (This
*
{@code String} is inserted at {@code start}
. (This
* sequence will be lengthened to accommodate the
* sequence will be lengthened to accommodate the
* specified String if necessary.)
* specified String if necessary.)
*
*
...
@@ -780,9 +780,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -780,9 +780,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* @param end The ending index, exclusive.
* @param end The ending index, exclusive.
* @param str String that will replace previous contents.
* @param str String that will replace previous contents.
* @return This object.
* @return This object.
* @throws StringIndexOutOfBoundsException if
<code>start</code>
* @throws StringIndexOutOfBoundsException if
{@code start}
* is negative, greater than
<code>length()</code>
, or
* is negative, greater than
{@code length()}
, or
* greater than
<code>end</code>
.
* greater than
{@code end}
.
*/
*/
public
AbstractStringBuilder
replace
(
int
start
,
int
end
,
String
str
)
{
public
AbstractStringBuilder
replace
(
int
start
,
int
end
,
String
str
)
{
if
(
start
<
0
)
if
(
start
<
0
)
...
@@ -805,14 +805,14 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -805,14 +805,14 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
}
}
/**
/**
* Returns a new
<code>String</code>
that contains a subsequence of
* Returns a new
{@code String}
that contains a subsequence of
* characters currently contained in this character sequence. The
* characters currently contained in this character sequence. The
* substring begins at the specified index and extends to the end of
* substring begins at the specified index and extends to the end of
* this sequence.
* this sequence.
*
*
* @param start The beginning index, inclusive.
* @param start The beginning index, inclusive.
* @return The new string.
* @return The new string.
* @throws StringIndexOutOfBoundsException if
<code>start</code>
is
* @throws StringIndexOutOfBoundsException if
{@code start}
is
* less than zero, or greater than the length of this object.
* less than zero, or greater than the length of this object.
*/
*/
public
String
substring
(
int
start
)
{
public
String
substring
(
int
start
)
{
...
@@ -850,18 +850,18 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -850,18 +850,18 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
}
}
/**
/**
* Returns a new
<code>String</code>
that contains a subsequence of
* Returns a new
{@code String}
that contains a subsequence of
* characters currently contained in this sequence. The
* characters currently contained in this sequence. The
* substring begins at the specified
<code>start</code>
and
* substring begins at the specified
{@code start}
and
* extends to the character at index
<code>end - 1</code>
.
* extends to the character at index
{@code end - 1}
.
*
*
* @param start The beginning index, inclusive.
* @param start The beginning index, inclusive.
* @param end The ending index, exclusive.
* @param end The ending index, exclusive.
* @return The new string.
* @return The new string.
* @throws StringIndexOutOfBoundsException if
<code>start</code>
* @throws StringIndexOutOfBoundsException if
{@code start}
* or
<code>end</code>
are negative or greater than
* or
{@code end}
are negative or greater than
*
<code>length()</code>, or <code>start</code>
is
*
{@code length()}, or {@code start}
is
* greater than
<code>end</code>
.
* greater than
{@code end}
.
*/
*/
public
String
substring
(
int
start
,
int
end
)
{
public
String
substring
(
int
start
,
int
end
)
{
if
(
start
<
0
)
if
(
start
<
0
)
...
@@ -1254,15 +1254,15 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1254,15 +1254,15 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* <blockquote><pre>
* <blockquote><pre>
* this.toString().startsWith(str, <i>k</i>)
* this.toString().startsWith(str, <i>k</i>)
* </pre></blockquote>
* </pre></blockquote>
* is
<code>true</code>
.
* is
{@code true}
.
*
*
* @param str any string.
* @param str any string.
* @return if the string argument occurs as a substring within this
* @return if the string argument occurs as a substring within this
* object, then the index of the first character of the first
* object, then the index of the first character of the first
* such substring is returned; if it does not occur as a
* such substring is returned; if it does not occur as a
* substring,
<code>-1</code>
is returned.
* substring,
{@code -1}
is returned.
* @throws java.lang.NullPointerException if
<code>str</code>
is
* @throws java.lang.NullPointerException if
{@code str}
is
*
<code>null</code>
.
*
{@code null}
.
*/
*/
public
int
indexOf
(
String
str
)
{
public
int
indexOf
(
String
str
)
{
return
indexOf
(
str
,
0
);
return
indexOf
(
str
,
0
);
...
@@ -1282,8 +1282,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1282,8 +1282,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* @param fromIndex the index from which to start the search.
* @param fromIndex the index from which to start the search.
* @return the index within this string of the first occurrence of the
* @return the index within this string of the first occurrence of the
* specified substring, starting at the specified index.
* specified substring, starting at the specified index.
* @throws java.lang.NullPointerException if
<code>str</code>
is
* @throws java.lang.NullPointerException if
{@code str}
is
*
<code>null</code>
.
*
{@code null}
.
*/
*/
public
int
indexOf
(
String
str
,
int
fromIndex
)
{
public
int
indexOf
(
String
str
,
int
fromIndex
)
{
return
String
.
indexOf
(
value
,
0
,
count
,
return
String
.
indexOf
(
value
,
0
,
count
,
...
@@ -1293,7 +1293,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1293,7 +1293,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Returns the index within this string of the rightmost occurrence
* Returns the index within this string of the rightmost occurrence
* of the specified substring. The rightmost empty string "" is
* of the specified substring. The rightmost empty string "" is
* considered to occur at the index value
<code>this.length()</code>
.
* considered to occur at the index value
{@code this.length()}
.
* The returned index is the largest value <i>k</i> such that
* The returned index is the largest value <i>k</i> such that
* <blockquote><pre>
* <blockquote><pre>
* this.toString().startsWith(str, k)
* this.toString().startsWith(str, k)
...
@@ -1304,9 +1304,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1304,9 +1304,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* @return if the string argument occurs one or more times as a substring
* @return if the string argument occurs one or more times as a substring
* within this object, then the index of the first character of
* within this object, then the index of the first character of
* the last such substring is returned. If it does not occur as
* the last such substring is returned. If it does not occur as
* a substring,
<code>-1</code>
is returned.
* a substring,
{@code -1}
is returned.
* @throws java.lang.NullPointerException if
<code>str</code>
is
* @throws java.lang.NullPointerException if
{@code str}
is
*
<code>null</code>
.
*
{@code null}
.
*/
*/
public
int
lastIndexOf
(
String
str
)
{
public
int
lastIndexOf
(
String
str
)
{
return
lastIndexOf
(
str
,
count
);
return
lastIndexOf
(
str
,
count
);
...
@@ -1326,8 +1326,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1326,8 +1326,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* @param fromIndex the index to start the search from.
* @param fromIndex the index to start the search from.
* @return the index within this sequence of the last occurrence of the
* @return the index within this sequence of the last occurrence of the
* specified substring.
* specified substring.
* @throws java.lang.NullPointerException if
<code>str</code>
is
* @throws java.lang.NullPointerException if
{@code str}
is
*
<code>null</code>
.
*
{@code null}
.
*/
*/
public
int
lastIndexOf
(
String
str
,
int
fromIndex
)
{
public
int
lastIndexOf
(
String
str
,
int
fromIndex
)
{
return
String
.
lastIndexOf
(
value
,
0
,
count
,
return
String
.
lastIndexOf
(
value
,
0
,
count
,
...
@@ -1342,8 +1342,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1342,8 +1342,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* is never reversed.
* is never reversed.
*
*
* Let <i>n</i> be the character length of this character sequence
* Let <i>n</i> be the character length of this character sequence
* (not the length in
<code>char</code>
values) just prior to
* (not the length in
{@code char}
values) just prior to
* execution of the
<code>reverse</code>
method. Then the
* execution of the
{@code reverse}
method. Then the
* character at index <i>k</i> in the new character sequence is
* character at index <i>k</i> in the new character sequence is
* equal to the character at index <i>n-k-1</i> in the old
* equal to the character at index <i>n-k-1</i> in the old
* character sequence.
* character sequence.
...
@@ -1351,7 +1351,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1351,7 +1351,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* <p>Note that the reverse operation may result in producing
* <p>Note that the reverse operation may result in producing
* surrogate pairs that were unpaired low-surrogates and
* surrogate pairs that were unpaired low-surrogates and
* high-surrogates before the operation. For example, reversing
* high-surrogates before the operation. For example, reversing
* "
\uDC00\uD800" produces "\uD800\
uDC00" which is
* "
\u005CuDC00\u005CuD800" produces "\u005CuD800\u005C
uDC00" which is
* a valid surrogate pair.
* a valid surrogate pair.
*
*
* @return a reference to this object.
* @return a reference to this object.
...
@@ -1387,11 +1387,11 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
...
@@ -1387,11 +1387,11 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
/**
* Returns a string representing the data in this sequence.
* Returns a string representing the data in this sequence.
* A new
<code>String</code>
object is allocated and initialized to
* A new
{@code String}
object is allocated and initialized to
* contain the character sequence currently represented by this
* contain the character sequence currently represented by this
* object. This
<code>String</code>
is then returned. Subsequent
* object. This
{@code String}
is then returned. Subsequent
* changes to this sequence do not affect the contents of the
* changes to this sequence do not affect the contents of the
*
<code>String</code>
.
*
{@code String}
.
*
*
* @return a string representation of this sequence of characters.
* @return a string representation of this sequence of characters.
*/
*/
...
...
src/share/classes/java/lang/Byte.java
浏览文件 @
c3b10b94
...
@@ -110,8 +110,8 @@ public final class Byte extends Number implements Comparable<Byte> {
...
@@ -110,8 +110,8 @@ public final class Byte extends Number implements Comparable<Byte> {
* determined by whether {@link java.lang.Character#digit(char,
* determined by whether {@link java.lang.Character#digit(char,
* int)} returns a nonnegative value) except that the first
* int)} returns a nonnegative value) except that the first
* character may be an ASCII minus sign {@code '-'}
* character may be an ASCII minus sign {@code '-'}
* (
<code>'\u002D'</code>
) to indicate a negative value or an
* (
{@code '\u005Cu002D'}
) to indicate a negative value or an
* ASCII plus sign {@code '+'} (
<code>'\u002B'</code>
) to
* ASCII plus sign {@code '+'} (
{@code '\u005Cu002B'}
) to
* indicate a positive value. The resulting {@code byte} value is
* indicate a positive value. The resulting {@code byte} value is
* returned.
* returned.
*
*
...
@@ -127,8 +127,8 @@ public final class Byte extends Number implements Comparable<Byte> {
...
@@ -127,8 +127,8 @@ public final class Byte extends Number implements Comparable<Byte> {
*
*
* <li> Any character of the string is not a digit of the
* <li> Any character of the string is not a digit of the
* specified radix, except that the first character may be a minus
* specified radix, except that the first character may be a minus
* sign {@code '-'} (
<code>'\u002D'</code>
) or plus sign
* sign {@code '-'} (
{@code '\u005Cu002D'}
) or plus sign
* {@code '+'} (
<code>'\u002B'</code>
) provided that the
* {@code '+'} (
{@code '\u005Cu002B'}
) provided that the
* string is longer than length 1.
* string is longer than length 1.
*
*
* <li> The value represented by the string is not a value of type
* <li> The value represented by the string is not a value of type
...
@@ -157,9 +157,9 @@ public final class Byte extends Number implements Comparable<Byte> {
...
@@ -157,9 +157,9 @@ public final class Byte extends Number implements Comparable<Byte> {
* Parses the string argument as a signed decimal {@code
* Parses the string argument as a signed decimal {@code
* byte}. The characters in the string must all be decimal digits,
* byte}. The characters in the string must all be decimal digits,
* except that the first character may be an ASCII minus sign
* except that the first character may be an ASCII minus sign
* {@code '-'} (
<code>'\u002D'</code>
) to indicate a negative
* {@code '-'} (
{@code '\u005Cu002D'}
) to indicate a negative
* value or an ASCII plus sign {@code '+'}
* value or an ASCII plus sign {@code '+'}
* (
<code>'\u002B'</code>
) to indicate a positive value. The
* (
{@code '\u005Cu002B'}
) to indicate a positive value. The
* resulting {@code byte} value is returned, exactly as if the
* resulting {@code byte} value is returned, exactly as if the
* argument and the radix 10 were given as arguments to the {@link
* argument and the radix 10 were given as arguments to the {@link
* #parseByte(java.lang.String, int)} method.
* #parseByte(java.lang.String, int)} method.
...
...
src/share/classes/java/lang/Double.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 1994, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -140,7 +140,7 @@ public final class Double extends Number implements Comparable<Double> {
...
@@ -140,7 +140,7 @@ public final class Double extends Number implements Comparable<Double> {
* <li>Otherwise, the result is a string that represents the sign and
* <li>Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. If the sign is negative,
* magnitude (absolute value) of the argument. If the sign is negative,
* the first character of the result is '{@code -}'
* the first character of the result is '{@code -}'
* (
<code>'\u002D'</code>
); if the sign is positive, no sign character
* (
{@code '\u005Cu002D'}
); if the sign is positive, no sign character
* appears in the result. As for the magnitude <i>m</i>:
* appears in the result. As for the magnitude <i>m</i>:
* <ul>
* <ul>
* <li>If <i>m</i> is infinity, it is represented by the characters
* <li>If <i>m</i> is infinity, it is represented by the characters
...
@@ -156,7 +156,7 @@ public final class Double extends Number implements Comparable<Double> {
...
@@ -156,7 +156,7 @@ public final class Double extends Number implements Comparable<Double> {
* <li>If <i>m</i> is greater than or equal to 10<sup>-3</sup> but less
* <li>If <i>m</i> is greater than or equal to 10<sup>-3</sup> but less
* than 10<sup>7</sup>, then it is represented as the integer part of
* than 10<sup>7</sup>, then it is represented as the integer part of
* <i>m</i>, in decimal form with no leading zeroes, followed by
* <i>m</i>, in decimal form with no leading zeroes, followed by
* '{@code .}' (
<code>'\u002E'</code>
), followed by one or
* '{@code .}' (
{@code '\u005Cu002E'}
), followed by one or
* more decimal digits representing the fractional part of <i>m</i>.
* more decimal digits representing the fractional part of <i>m</i>.
*
*
* <li>If <i>m</i> is less than 10<sup>-3</sup> or greater than or
* <li>If <i>m</i> is less than 10<sup>-3</sup> or greater than or
...
@@ -168,9 +168,9 @@ public final class Double extends Number implements Comparable<Double> {
...
@@ -168,9 +168,9 @@ public final class Double extends Number implements Comparable<Double> {
* 10<sup><i>n</i></sup> so that 1 ≤ <i>a</i> {@literal <} 10. The
* 10<sup><i>n</i></sup> so that 1 ≤ <i>a</i> {@literal <} 10. The
* magnitude is then represented as the integer part of <i>a</i>,
* magnitude is then represented as the integer part of <i>a</i>,
* as a single decimal digit, followed by '{@code .}'
* as a single decimal digit, followed by '{@code .}'
* (
<code>'\u002E'</code>
), followed by decimal digits
* (
{@code '\u005Cu002E'}
), followed by decimal digits
* representing the fractional part of <i>a</i>, followed by the
* representing the fractional part of <i>a</i>, followed by the
* letter '{@code E}' (
<code>'\u0045'</code>
), followed
* letter '{@code E}' (
{@code '\u005Cu0045'}
), followed
* by a representation of <i>n</i> as a decimal integer, as
* by a representation of <i>n</i> as a decimal integer, as
* produced by the method {@link Integer#toString(int)}.
* produced by the method {@link Integer#toString(int)}.
* </ul>
* </ul>
...
@@ -208,7 +208,7 @@ public final class Double extends Number implements Comparable<Double> {
...
@@ -208,7 +208,7 @@ public final class Double extends Number implements Comparable<Double> {
* <li>Otherwise, the result is a string that represents the sign
* <li>Otherwise, the result is a string that represents the sign
* and magnitude of the argument. If the sign is negative, the
* and magnitude of the argument. If the sign is negative, the
* first character of the result is '{@code -}'
* first character of the result is '{@code -}'
* (
<code>'\u002D'</code>
); if the sign is positive, no sign
* (
{@code '\u005Cu002D'}
); if the sign is positive, no sign
* character appears in the result. As for the magnitude <i>m</i>:
* character appears in the result. As for the magnitude <i>m</i>:
*
*
* <ul>
* <ul>
...
...
src/share/classes/java/lang/Float.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 1994, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -138,7 +138,7 @@ public final class Float extends Number implements Comparable<Float> {
...
@@ -138,7 +138,7 @@ public final class Float extends Number implements Comparable<Float> {
* <li>Otherwise, the result is a string that represents the sign and
* <li>Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. If the sign is
* magnitude (absolute value) of the argument. If the sign is
* negative, the first character of the result is
* negative, the first character of the result is
* '{@code -}' (
<code>'\u002D'</code>
); if the sign is
* '{@code -}' (
{@code '\u005Cu002D'}
); if the sign is
* positive, no sign character appears in the result. As for
* positive, no sign character appears in the result. As for
* the magnitude <i>m</i>:
* the magnitude <i>m</i>:
* <ul>
* <ul>
...
@@ -154,7 +154,7 @@ public final class Float extends Number implements Comparable<Float> {
...
@@ -154,7 +154,7 @@ public final class Float extends Number implements Comparable<Float> {
* less than 10<sup>7</sup>, then it is represented as the
* less than 10<sup>7</sup>, then it is represented as the
* integer part of <i>m</i>, in decimal form with no leading
* integer part of <i>m</i>, in decimal form with no leading
* zeroes, followed by '{@code .}'
* zeroes, followed by '{@code .}'
* (
<code>'\u002E'</code>
), followed by one or more
* (
{@code '\u005Cu002E'}
), followed by one or more
* decimal digits representing the fractional part of
* decimal digits representing the fractional part of
* <i>m</i>.
* <i>m</i>.
* <li> If <i>m</i> is less than 10<sup>-3</sup> or greater than or
* <li> If <i>m</i> is less than 10<sup>-3</sup> or greater than or
...
@@ -166,10 +166,10 @@ public final class Float extends Number implements Comparable<Float> {
...
@@ -166,10 +166,10 @@ public final class Float extends Number implements Comparable<Float> {
* 10<sup><i>n</i></sup> so that 1 ≤ <i>a</i> {@literal <} 10.
* 10<sup><i>n</i></sup> so that 1 ≤ <i>a</i> {@literal <} 10.
* The magnitude is then represented as the integer part of
* The magnitude is then represented as the integer part of
* <i>a</i>, as a single decimal digit, followed by
* <i>a</i>, as a single decimal digit, followed by
* '{@code .}' (
<code>'\u002E'</code>
), followed by
* '{@code .}' (
{@code '\u005Cu002E'}
), followed by
* decimal digits representing the fractional part of
* decimal digits representing the fractional part of
* <i>a</i>, followed by the letter '{@code E}'
* <i>a</i>, followed by the letter '{@code E}'
* (
<code>'\u0045'</code>
), followed by a representation
* (
{@code '\u005Cu0045'}
), followed by a representation
* of <i>n</i> as a decimal integer, as produced by the
* of <i>n</i> as a decimal integer, as produced by the
* method {@link java.lang.Integer#toString(int)}.
* method {@link java.lang.Integer#toString(int)}.
*
*
...
@@ -210,7 +210,7 @@ public final class Float extends Number implements Comparable<Float> {
...
@@ -210,7 +210,7 @@ public final class Float extends Number implements Comparable<Float> {
* <li>Otherwise, the result is a string that represents the sign and
* <li>Otherwise, the result is a string that represents the sign and
* magnitude (absolute value) of the argument. If the sign is negative,
* magnitude (absolute value) of the argument. If the sign is negative,
* the first character of the result is '{@code -}'
* the first character of the result is '{@code -}'
* (
<code>'\u002D'</code>
); if the sign is positive, no sign character
* (
{@code '\u005Cu002D'}
); if the sign is positive, no sign character
* appears in the result. As for the magnitude <i>m</i>:
* appears in the result. As for the magnitude <i>m</i>:
*
*
* <ul>
* <ul>
...
...
src/share/classes/java/lang/Integer.java
浏览文件 @
c3b10b94
...
@@ -93,13 +93,13 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -93,13 +93,13 @@ public final class Integer extends Number implements Comparable<Integer> {
*
*
* <p>If the first argument is negative, the first element of the
* <p>If the first argument is negative, the first element of the
* result is the ASCII minus character {@code '-'}
* result is the ASCII minus character {@code '-'}
* (
<code>'\u002D'</code>
). If the first argument is not
* (
{@code '\u005Cu002D'}
). If the first argument is not
* negative, no sign character appears in the result.
* negative, no sign character appears in the result.
*
*
* <p>The remaining characters of the result represent the magnitude
* <p>The remaining characters of the result represent the magnitude
* of the first argument. If the magnitude is zero, it is
* of the first argument. If the magnitude is zero, it is
* represented by a single zero character {@code '0'}
* represented by a single zero character {@code '0'}
* (
<code>'\u0030'</code>
); otherwise, the first character of
* (
{@code '\u005Cu0030'}
); otherwise, the first character of
* the representation of the magnitude will not be the zero
* the representation of the magnitude will not be the zero
* character. The following ASCII characters are used as digits:
* character. The following ASCII characters are used as digits:
*
*
...
@@ -107,9 +107,9 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -107,9 +107,9 @@ public final class Integer extends Number implements Comparable<Integer> {
* {@code 0123456789abcdefghijklmnopqrstuvwxyz}
* {@code 0123456789abcdefghijklmnopqrstuvwxyz}
* </blockquote>
* </blockquote>
*
*
* These are
<code>'\u0030'</code>
through
* These are
{@code '\u005Cu0030'}
through
*
<code>'\u0039'</code> and <code>'\u0061'</code>
through
*
{@code '\u005Cu0039'} and {@code '\u005Cu0061'}
through
*
<code>'\u007A'</code>
. If {@code radix} is
*
{@code '\u005Cu007A'}
. If {@code radix} is
* <var>N</var>, then the first <var>N</var> of these characters
* <var>N</var>, then the first <var>N</var> of these characters
* are used as radix-<var>N</var> digits in the order shown. Thus,
* are used as radix-<var>N</var> digits in the order shown. Thus,
* the digits for hexadecimal (radix 16) are
* the digits for hexadecimal (radix 16) are
...
@@ -170,7 +170,7 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -170,7 +170,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* value, no leading sign character is printed.
* value, no leading sign character is printed.
*
*
* <p>If the magnitude is zero, it is represented by a single zero
* <p>If the magnitude is zero, it is represented by a single zero
* character {@code '0'} (
<code>'\u0030'</code>
); otherwise,
* character {@code '0'} (
{@code '\u005Cu0030'}
); otherwise,
* the first character of the representation of the magnitude will
* the first character of the representation of the magnitude will
* not be the zero character.
* not be the zero character.
*
*
...
@@ -203,7 +203,7 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -203,7 +203,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* Integer.parseUnsignedInt(s, 16)}.
* Integer.parseUnsignedInt(s, 16)}.
*
*
* <p>If the unsigned magnitude is zero, it is represented by a
* <p>If the unsigned magnitude is zero, it is represented by a
* single zero character {@code '0'} (
<code>'\u0030'</code>
);
* single zero character {@code '0'} (
{@code '\u005Cu0030'}
);
* otherwise, the first character of the representation of the
* otherwise, the first character of the representation of the
* unsigned magnitude will not be the zero character. The
* unsigned magnitude will not be the zero character. The
* following characters are used as hexadecimal digits:
* following characters are used as hexadecimal digits:
...
@@ -212,9 +212,9 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -212,9 +212,9 @@ public final class Integer extends Number implements Comparable<Integer> {
* {@code 0123456789abcdef}
* {@code 0123456789abcdef}
* </blockquote>
* </blockquote>
*
*
* These are the characters
<code>'\u0030'</code>
through
* These are the characters
{@code '\u005Cu0030'}
through
*
<code>'\u0039'</code> and <code>'\u0061'</code>
through
*
{@code '\u005Cu0039'} and {@code '\u005Cu0061'}
through
*
<code>'\u0066'</code>
. If uppercase letters are
*
{@code '\u005Cu0066'}
. If uppercase letters are
* desired, the {@link java.lang.String#toUpperCase()} method may
* desired, the {@link java.lang.String#toUpperCase()} method may
* be called on the result:
* be called on the result:
*
*
...
@@ -248,7 +248,7 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -248,7 +248,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* Integer.parseUnsignedInt(s, 8)}.
* Integer.parseUnsignedInt(s, 8)}.
*
*
* <p>If the unsigned magnitude is zero, it is represented by a
* <p>If the unsigned magnitude is zero, it is represented by a
* single zero character {@code '0'} (
<code>'\u0030'</code>
);
* single zero character {@code '0'} (
{@code '\u005Cu0030'}
);
* otherwise, the first character of the representation of the
* otherwise, the first character of the representation of the
* unsigned magnitude will not be the zero character. The
* unsigned magnitude will not be the zero character. The
* following characters are used as octal digits:
* following characters are used as octal digits:
...
@@ -257,8 +257,8 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -257,8 +257,8 @@ public final class Integer extends Number implements Comparable<Integer> {
* {@code 01234567}
* {@code 01234567}
* </blockquote>
* </blockquote>
*
*
* These are the characters
<code>'\u0030'</code>
through
* These are the characters
{@code '\u005Cu0030'}
through
*
<code>'\u0037'</code>
.
*
{@code '\u005Cu0037'}
.
*
*
* @param i an integer to be converted to a string.
* @param i an integer to be converted to a string.
* @return the string representation of the unsigned integer value
* @return the string representation of the unsigned integer value
...
@@ -286,11 +286,11 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -286,11 +286,11 @@ public final class Integer extends Number implements Comparable<Integer> {
* Integer.parseUnsignedInt(s, 2)}.
* Integer.parseUnsignedInt(s, 2)}.
*
*
* <p>If the unsigned magnitude is zero, it is represented by a
* <p>If the unsigned magnitude is zero, it is represented by a
* single zero character {@code '0'} (
<code>'\u0030'</code>
);
* single zero character {@code '0'} (
{@code '\u005Cu0030'}
);
* otherwise, the first character of the representation of the
* otherwise, the first character of the representation of the
* unsigned magnitude will not be the zero character. The
* unsigned magnitude will not be the zero character. The
* characters {@code '0'} (
<code>'\u0030'</code>
) and {@code
* characters {@code '0'} (
{@code '\u005Cu0030'}
) and {@code
* '1'} (
<code>'\u0031'</code>
) are used as binary digits.
* '1'} (
{@code '\u005Cu0031'}
) are used as binary digits.
*
*
* @param i an integer to be converted to a string.
* @param i an integer to be converted to a string.
* @return the string representation of the unsigned integer value
* @return the string representation of the unsigned integer value
...
@@ -461,9 +461,9 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -461,9 +461,9 @@ public final class Integer extends Number implements Comparable<Integer> {
* must all be digits of the specified radix (as determined by
* must all be digits of the specified radix (as determined by
* whether {@link java.lang.Character#digit(char, int)} returns a
* whether {@link java.lang.Character#digit(char, int)} returns a
* nonnegative value), except that the first character may be an
* nonnegative value), except that the first character may be an
* ASCII minus sign {@code '-'} (
<code>'\u002D'</code>
) to
* ASCII minus sign {@code '-'} (
{@code '\u005Cu002D'}
) to
* indicate a negative value or an ASCII plus sign {@code '+'}
* indicate a negative value or an ASCII plus sign {@code '+'}
* (
<code>'\u002B'</code>
) to indicate a positive value. The
* (
{@code '\u005Cu002B'}
) to indicate a positive value. The
* resulting integer value is returned.
* resulting integer value is returned.
*
*
* <p>An exception of type {@code NumberFormatException} is
* <p>An exception of type {@code NumberFormatException} is
...
@@ -478,8 +478,8 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -478,8 +478,8 @@ public final class Integer extends Number implements Comparable<Integer> {
*
*
* <li>Any character of the string is not a digit of the specified
* <li>Any character of the string is not a digit of the specified
* radix, except that the first character may be a minus sign
* radix, except that the first character may be a minus sign
* {@code '-'} (
<code>'\u002D'</code>
) or plus sign
* {@code '-'} (
{@code '\u005Cu002D'}
) or plus sign
* {@code '+'} (
<code>'\u002B'</code>
) provided that the
* {@code '+'} (
{@code '\u005Cu002B'}
) provided that the
* string is longer than length 1.
* string is longer than length 1.
*
*
* <li>The value represented by the string is not a value of type
* <li>The value represented by the string is not a value of type
...
@@ -579,8 +579,8 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -579,8 +579,8 @@ public final class Integer extends Number implements Comparable<Integer> {
* Parses the string argument as a signed decimal integer. The
* Parses the string argument as a signed decimal integer. The
* characters in the string must all be decimal digits, except
* characters in the string must all be decimal digits, except
* that the first character may be an ASCII minus sign {@code '-'}
* that the first character may be an ASCII minus sign {@code '-'}
* (
<code>'\u002D'</code>
) to indicate a negative value or an
* (
{@code '\u005Cu002D'}
) to indicate a negative value or an
* ASCII plus sign {@code '+'} (
<code>'\u002B'</code>
) to
* ASCII plus sign {@code '+'} (
{@code '\u005Cu002B'}
) to
* indicate a positive value. The resulting integer value is
* indicate a positive value. The resulting integer value is
* returned, exactly as if the argument and the radix 10 were
* returned, exactly as if the argument and the radix 10 were
* given as arguments to the {@link #parseInt(java.lang.String,
* given as arguments to the {@link #parseInt(java.lang.String,
...
@@ -606,7 +606,7 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -606,7 +606,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* specified radix (as determined by whether {@link
* specified radix (as determined by whether {@link
* java.lang.Character#digit(char, int)} returns a nonnegative
* java.lang.Character#digit(char, int)} returns a nonnegative
* value), except that the first character may be an ASCII plus
* value), except that the first character may be an ASCII plus
* sign {@code '+'} (
<code>'\u002B'</code>
). The resulting
* sign {@code '+'} (
{@code '\u005Cu002B'}
). The resulting
* integer value is returned.
* integer value is returned.
*
*
* <p>An exception of type {@code NumberFormatException} is
* <p>An exception of type {@code NumberFormatException} is
...
@@ -621,7 +621,7 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -621,7 +621,7 @@ public final class Integer extends Number implements Comparable<Integer> {
*
*
* <li>Any character of the string is not a digit of the specified
* <li>Any character of the string is not a digit of the specified
* radix, except that the first character may be a plus sign
* radix, except that the first character may be a plus sign
* {@code '+'} (
<code>'\u002B'</code>
) provided that the
* {@code '+'} (
{@code '\u005Cu002B'}
) provided that the
* string is longer than length 1.
* string is longer than length 1.
*
*
* <li>The value represented by the string is larger than the
* <li>The value represented by the string is larger than the
...
@@ -676,7 +676,7 @@ public final class Integer extends Number implements Comparable<Integer> {
...
@@ -676,7 +676,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* Parses the string argument as an unsigned decimal integer. The
* Parses the string argument as an unsigned decimal integer. The
* characters in the string must all be decimal digits, except
* characters in the string must all be decimal digits, except
* that the first character may be an an ASCII plus sign {@code
* that the first character may be an an ASCII plus sign {@code
* '+'} (
<code>'\u002B'</code>
). The resulting integer value
* '+'} (
{@code '\u005Cu002B'}
). The resulting integer value
* is returned, exactly as if the argument and the radix 10 were
* is returned, exactly as if the argument and the radix 10 were
* given as arguments to the {@link
* given as arguments to the {@link
* #parseUnsignedInt(java.lang.String, int)} method.
* #parseUnsignedInt(java.lang.String, int)} method.
...
...
src/share/classes/java/lang/Long.java
浏览文件 @
c3b10b94
...
@@ -81,13 +81,13 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -81,13 +81,13 @@ public final class Long extends Number implements Comparable<Long> {
*
*
* <p>If the first argument is negative, the first element of the
* <p>If the first argument is negative, the first element of the
* result is the ASCII minus sign {@code '-'}
* result is the ASCII minus sign {@code '-'}
* (
<code>'\u002d'</code>
). If the first argument is not
* (
{@code '\u005Cu002d'}
). If the first argument is not
* negative, no sign character appears in the result.
* negative, no sign character appears in the result.
*
*
* <p>The remaining characters of the result represent the magnitude
* <p>The remaining characters of the result represent the magnitude
* of the first argument. If the magnitude is zero, it is
* of the first argument. If the magnitude is zero, it is
* represented by a single zero character {@code '0'}
* represented by a single zero character {@code '0'}
* (
<code>'\u0030'</code>
); otherwise, the first character of
* (
{@code '\u005Cu0030'}
); otherwise, the first character of
* the representation of the magnitude will not be the zero
* the representation of the magnitude will not be the zero
* character. The following ASCII characters are used as digits:
* character. The following ASCII characters are used as digits:
*
*
...
@@ -95,9 +95,9 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -95,9 +95,9 @@ public final class Long extends Number implements Comparable<Long> {
* {@code 0123456789abcdefghijklmnopqrstuvwxyz}
* {@code 0123456789abcdefghijklmnopqrstuvwxyz}
* </blockquote>
* </blockquote>
*
*
* These are
<code>'\u0030'</code>
through
* These are
{@code '\u005Cu0030'}
through
*
<code>'\u0039'</code> and <code>'\u0061'</code>
through
*
{@code '\u005Cu0039'} and {@code '\u005Cu0061'}
through
*
<code>'\u007a'</code>
. If {@code radix} is
*
{@code '\u005Cu007a'}
. If {@code radix} is
* <var>N</var>, then the first <var>N</var> of these characters
* <var>N</var>, then the first <var>N</var> of these characters
* are used as radix-<var>N</var> digits in the order shown. Thus,
* are used as radix-<var>N</var> digits in the order shown. Thus,
* the digits for hexadecimal (radix 16) are
* the digits for hexadecimal (radix 16) are
...
@@ -154,7 +154,7 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -154,7 +154,7 @@ public final class Long extends Number implements Comparable<Long> {
* value, no leading sign character is printed.
* value, no leading sign character is printed.
*
*
* <p>If the magnitude is zero, it is represented by a single zero
* <p>If the magnitude is zero, it is represented by a single zero
* character {@code '0'} (
<code>'\u0030'</code>
); otherwise,
* character {@code '0'} (
{@code '\u005Cu0030'}
); otherwise,
* the first character of the representation of the magnitude will
* the first character of the representation of the magnitude will
* not be the zero character.
* not be the zero character.
*
*
...
@@ -239,7 +239,7 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -239,7 +239,7 @@ public final class Long extends Number implements Comparable<Long> {
* 16)}.
* 16)}.
*
*
* <p>If the unsigned magnitude is zero, it is represented by a
* <p>If the unsigned magnitude is zero, it is represented by a
* single zero character {@code '0'} (
<code>'\u0030'</code>
);
* single zero character {@code '0'} (
{@code '\u005Cu0030'}
);
* otherwise, the first character of the representation of the
* otherwise, the first character of the representation of the
* unsigned magnitude will not be the zero character. The
* unsigned magnitude will not be the zero character. The
* following characters are used as hexadecimal digits:
* following characters are used as hexadecimal digits:
...
@@ -248,9 +248,9 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -248,9 +248,9 @@ public final class Long extends Number implements Comparable<Long> {
* {@code 0123456789abcdef}
* {@code 0123456789abcdef}
* </blockquote>
* </blockquote>
*
*
* These are the characters
<code>'\u0030'</code>
through
* These are the characters
{@code '\u005Cu0030'}
through
*
<code>'\u0039'</code> and <code>'\u0061'</code>
through
*
{@code '\u005Cu0039'} and {@code '\u005Cu0061'}
through
*
<code>'\u0066'</code>
. If uppercase letters are desired,
*
{@code '\u005Cu0066'}
. If uppercase letters are desired,
* the {@link java.lang.String#toUpperCase()} method may be called
* the {@link java.lang.String#toUpperCase()} method may be called
* on the result:
* on the result:
*
*
...
@@ -286,7 +286,7 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -286,7 +286,7 @@ public final class Long extends Number implements Comparable<Long> {
* 8)}.
* 8)}.
*
*
* <p>If the unsigned magnitude is zero, it is represented by a
* <p>If the unsigned magnitude is zero, it is represented by a
* single zero character {@code '0'} (
<code>'\u0030'</code>
);
* single zero character {@code '0'} (
{@code '\u005Cu0030'}
);
* otherwise, the first character of the representation of the
* otherwise, the first character of the representation of the
* unsigned magnitude will not be the zero character. The
* unsigned magnitude will not be the zero character. The
* following characters are used as octal digits:
* following characters are used as octal digits:
...
@@ -295,8 +295,8 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -295,8 +295,8 @@ public final class Long extends Number implements Comparable<Long> {
* {@code 01234567}
* {@code 01234567}
* </blockquote>
* </blockquote>
*
*
* These are the characters
<code>'\u0030'</code>
through
* These are the characters
{@code '\u005Cu0030'}
through
*
<code>'\u0037'</code>
.
*
{@code '\u005Cu0037'}
.
*
*
* @param i a {@code long} to be converted to a string.
* @param i a {@code long} to be converted to a string.
* @return the string representation of the unsigned {@code long}
* @return the string representation of the unsigned {@code long}
...
@@ -325,11 +325,11 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -325,11 +325,11 @@ public final class Long extends Number implements Comparable<Long> {
* 2)}.
* 2)}.
*
*
* <p>If the unsigned magnitude is zero, it is represented by a
* <p>If the unsigned magnitude is zero, it is represented by a
* single zero character {@code '0'} (
<code>'\u0030'</code>
);
* single zero character {@code '0'} (
{@code '\u005Cu0030'}
);
* otherwise, the first character of the representation of the
* otherwise, the first character of the representation of the
* unsigned magnitude will not be the zero character. The
* unsigned magnitude will not be the zero character. The
* characters {@code '0'} (
<code>'\u0030'</code>
) and {@code
* characters {@code '0'} (
{@code '\u005Cu0030'}
) and {@code
* '1'} (
<code>'\u0031'</code>
) are used as binary digits.
* '1'} (
{@code '\u005Cu0031'}
) are used as binary digits.
*
*
* @param i a {@code long} to be converted to a string.
* @param i a {@code long} to be converted to a string.
* @return the string representation of the unsigned {@code long}
* @return the string representation of the unsigned {@code long}
...
@@ -467,14 +467,14 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -467,14 +467,14 @@ public final class Long extends Number implements Comparable<Long> {
* string must all be digits of the specified radix (as determined
* string must all be digits of the specified radix (as determined
* by whether {@link java.lang.Character#digit(char, int)} returns
* by whether {@link java.lang.Character#digit(char, int)} returns
* a nonnegative value), except that the first character may be an
* a nonnegative value), except that the first character may be an
* ASCII minus sign {@code '-'} (
<code>'\u002D'</code>
) to
* ASCII minus sign {@code '-'} (
{@code '\u005Cu002D'}
) to
* indicate a negative value or an ASCII plus sign {@code '+'}
* indicate a negative value or an ASCII plus sign {@code '+'}
* (
<code>'\u002B'</code>
) to indicate a positive value. The
* (
{@code '\u005Cu002B'}
) to indicate a positive value. The
* resulting {@code long} value is returned.
* resulting {@code long} value is returned.
*
*
* <p>Note that neither the character {@code L}
* <p>Note that neither the character {@code L}
* (
<code>'\u004C'</code>
) nor {@code l}
* (
{@code '\u005Cu004C'}
) nor {@code l}
* (
<code>'\u006C'</code>
) is permitted to appear at the end
* (
{@code '\u005Cu006C'}
) is permitted to appear at the end
* of the string as a type indicator, as would be permitted in
* of the string as a type indicator, as would be permitted in
* Java programming language source code - except that either
* Java programming language source code - except that either
* {@code L} or {@code l} may appear as a digit for a
* {@code L} or {@code l} may appear as a digit for a
...
@@ -493,8 +493,8 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -493,8 +493,8 @@ public final class Long extends Number implements Comparable<Long> {
*
*
* <li>Any character of the string is not a digit of the specified
* <li>Any character of the string is not a digit of the specified
* radix, except that the first character may be a minus sign
* radix, except that the first character may be a minus sign
* {@code '-'} (
<code>'\u002d'</code>
) or plus sign {@code
* {@code '-'} (
{@code '\u005Cu002d'}
) or plus sign {@code
* '+'} (
<code>'\u002B'</code>
) provided that the string is
* '+'} (
{@code '\u005Cu002B'}
) provided that the string is
* longer than length 1.
* longer than length 1.
*
*
* <li>The value represented by the string is not a value of type
* <li>The value represented by the string is not a value of type
...
@@ -584,16 +584,16 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -584,16 +584,16 @@ public final class Long extends Number implements Comparable<Long> {
* Parses the string argument as a signed decimal {@code long}.
* Parses the string argument as a signed decimal {@code long}.
* The characters in the string must all be decimal digits, except
* The characters in the string must all be decimal digits, except
* that the first character may be an ASCII minus sign {@code '-'}
* that the first character may be an ASCII minus sign {@code '-'}
* (
<code>\u002D'</code>
) to indicate a negative value or an
* (
{@code \u005Cu002D'}
) to indicate a negative value or an
* ASCII plus sign {@code '+'} (
<code>'\u002B'</code>
) to
* ASCII plus sign {@code '+'} (
{@code '\u005Cu002B'}
) to
* indicate a positive value. The resulting {@code long} value is
* indicate a positive value. The resulting {@code long} value is
* returned, exactly as if the argument and the radix {@code 10}
* returned, exactly as if the argument and the radix {@code 10}
* were given as arguments to the {@link
* were given as arguments to the {@link
* #parseLong(java.lang.String, int)} method.
* #parseLong(java.lang.String, int)} method.
*
*
* <p>Note that neither the character {@code L}
* <p>Note that neither the character {@code L}
* (
<code>'\u004C'</code>
) nor {@code l}
* (
{@code '\u005Cu004C'}
) nor {@code l}
* (
<code>'\u006C'</code>
) is permitted to appear at the end
* (
{@code '\u005Cu006C'}
) is permitted to appear at the end
* of the string as a type indicator, as would be permitted in
* of the string as a type indicator, as would be permitted in
* Java programming language source code.
* Java programming language source code.
*
*
...
@@ -618,7 +618,7 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -618,7 +618,7 @@ public final class Long extends Number implements Comparable<Long> {
* specified radix (as determined by whether {@link
* specified radix (as determined by whether {@link
* java.lang.Character#digit(char, int)} returns a nonnegative
* java.lang.Character#digit(char, int)} returns a nonnegative
* value), except that the first character may be an ASCII plus
* value), except that the first character may be an ASCII plus
* sign {@code '+'} (
<code>'\u002B'</code>
). The resulting
* sign {@code '+'} (
{@code '\u005Cu002B'}
). The resulting
* integer value is returned.
* integer value is returned.
*
*
* <p>An exception of type {@code NumberFormatException} is
* <p>An exception of type {@code NumberFormatException} is
...
@@ -633,7 +633,7 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -633,7 +633,7 @@ public final class Long extends Number implements Comparable<Long> {
*
*
* <li>Any character of the string is not a digit of the specified
* <li>Any character of the string is not a digit of the specified
* radix, except that the first character may be a plus sign
* radix, except that the first character may be a plus sign
* {@code '+'} (
<code>'\u002B'</code>
) provided that the
* {@code '+'} (
{@code '\u005Cu002B'}
) provided that the
* string is longer than length 1.
* string is longer than length 1.
*
*
* <li>The value represented by the string is larger than the
* <li>The value represented by the string is larger than the
...
@@ -707,7 +707,7 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -707,7 +707,7 @@ public final class Long extends Number implements Comparable<Long> {
* Parses the string argument as an unsigned decimal {@code long}. The
* Parses the string argument as an unsigned decimal {@code long}. The
* characters in the string must all be decimal digits, except
* characters in the string must all be decimal digits, except
* that the first character may be an an ASCII plus sign {@code
* that the first character may be an an ASCII plus sign {@code
* '+'} (
<code>'\u002B'</code>
). The resulting integer value
* '+'} (
{@code '\u005Cu002B'}
). The resulting integer value
* is returned, exactly as if the argument and the radix 10 were
* is returned, exactly as if the argument and the radix 10 were
* given as arguments to the {@link
* given as arguments to the {@link
* #parseUnsignedLong(java.lang.String, int)} method.
* #parseUnsignedLong(java.lang.String, int)} method.
...
@@ -1148,8 +1148,8 @@ public final class Long extends Number implements Comparable<Long> {
...
@@ -1148,8 +1148,8 @@ public final class Long extends Number implements Comparable<Long> {
* </ul>
* </ul>
*
*
* <p>Note that, in every case, neither {@code L}
* <p>Note that, in every case, neither {@code L}
* (
<code>'\u004C'</code>
) nor {@code l}
* (
{@code '\u005Cu004C'}
) nor {@code l}
* (
<code>'\u006C'</code>
) is permitted to appear at the end
* (
{@code '\u005Cu006C'}
) is permitted to appear at the end
* of the property value as a type indicator, as would be
* of the property value as a type indicator, as would be
* permitted in Java programming language source code.
* permitted in Java programming language source code.
*
*
...
...
src/share/classes/java/lang/Short.java
浏览文件 @
c3b10b94
...
@@ -80,8 +80,8 @@ public final class Short extends Number implements Comparable<Short> {
...
@@ -80,8 +80,8 @@ public final class Short extends Number implements Comparable<Short> {
* determined by whether {@link java.lang.Character#digit(char,
* determined by whether {@link java.lang.Character#digit(char,
* int)} returns a nonnegative value) except that the first
* int)} returns a nonnegative value) except that the first
* character may be an ASCII minus sign {@code '-'}
* character may be an ASCII minus sign {@code '-'}
* (
<code>'\u002D'</code>
) to indicate a negative value or an
* (
{@code '\u005Cu002D'}
) to indicate a negative value or an
* ASCII plus sign {@code '+'} (
<code>'\u002B'</code>
) to
* ASCII plus sign {@code '+'} (
{@code '\u005Cu002B'}
) to
* indicate a positive value. The resulting {@code short} value
* indicate a positive value. The resulting {@code short} value
* is returned.
* is returned.
*
*
...
@@ -97,8 +97,8 @@ public final class Short extends Number implements Comparable<Short> {
...
@@ -97,8 +97,8 @@ public final class Short extends Number implements Comparable<Short> {
*
*
* <li> Any character of the string is not a digit of the
* <li> Any character of the string is not a digit of the
* specified radix, except that the first character may be a minus
* specified radix, except that the first character may be a minus
* sign {@code '-'} (
<code>'\u002D'</code>
) or plus sign
* sign {@code '-'} (
{@code '\u005Cu002D'}
) or plus sign
* {@code '+'} (
<code>'\u002B'</code>
) provided that the
* {@code '+'} (
{@code '\u005Cu002B'}
) provided that the
* string is longer than length 1.
* string is longer than length 1.
*
*
* <li> The value represented by the string is not a value of type
* <li> The value represented by the string is not a value of type
...
@@ -126,9 +126,9 @@ public final class Short extends Number implements Comparable<Short> {
...
@@ -126,9 +126,9 @@ public final class Short extends Number implements Comparable<Short> {
* Parses the string argument as a signed decimal {@code
* Parses the string argument as a signed decimal {@code
* short}. The characters in the string must all be decimal
* short}. The characters in the string must all be decimal
* digits, except that the first character may be an ASCII minus
* digits, except that the first character may be an ASCII minus
* sign {@code '-'} (
<code>'\u002D'</code>
) to indicate a
* sign {@code '-'} (
{@code '\u005Cu002D'}
) to indicate a
* negative value or an ASCII plus sign {@code '+'}
* negative value or an ASCII plus sign {@code '+'}
* (
<code>'\u002B'</code>
) to indicate a positive value. The
* (
{@code '\u005Cu002B'}
) to indicate a positive value. The
* resulting {@code short} value is returned, exactly as if the
* resulting {@code short} value is returned, exactly as if the
* argument and the radix 10 were given as arguments to the {@link
* argument and the radix 10 were given as arguments to the {@link
* #parseShort(java.lang.String, int)} method.
* #parseShort(java.lang.String, int)} method.
...
...
src/share/classes/java/lang/String.java
浏览文件 @
c3b10b94
...
@@ -39,8 +39,8 @@ import java.util.regex.Pattern;
...
@@ -39,8 +39,8 @@ import java.util.regex.Pattern;
import
java.util.regex.PatternSyntaxException
;
import
java.util.regex.PatternSyntaxException
;
/**
/**
* The
<code>String</code>
class represents character strings. All
* The
{@code String}
class represents character strings. All
* string literals in Java programs, such as
<code>"abc"</code>
, are
* string literals in Java programs, such as
{@code "abc"}
, are
* implemented as instances of this class.
* implemented as instances of this class.
* <p>
* <p>
* Strings are constant; their values cannot be changed after they
* Strings are constant; their values cannot be changed after they
...
@@ -63,7 +63,7 @@ import java.util.regex.PatternSyntaxException;
...
@@ -63,7 +63,7 @@ import java.util.regex.PatternSyntaxException;
* String d = cde.substring(1, 2);
* String d = cde.substring(1, 2);
* </pre></blockquote>
* </pre></blockquote>
* <p>
* <p>
* The class
<code>String</code>
includes methods for examining
* The class
{@code String}
includes methods for examining
* individual characters of the sequence, for comparing strings, for
* individual characters of the sequence, for comparing strings, for
* searching strings, for extracting substrings, and for creating a
* searching strings, for extracting substrings, and for creating a
* copy of a string with all characters translated to uppercase or to
* copy of a string with all characters translated to uppercase or to
...
@@ -73,10 +73,10 @@ import java.util.regex.PatternSyntaxException;
...
@@ -73,10 +73,10 @@ import java.util.regex.PatternSyntaxException;
* The Java language provides special support for the string
* The Java language provides special support for the string
* concatenation operator ( + ), and for conversion of
* concatenation operator ( + ), and for conversion of
* other objects to strings. String concatenation is implemented
* other objects to strings. String concatenation is implemented
* through the
<code>StringBuilder</code>(or <code>StringBuffer</code>
)
* through the
{@code StringBuilder}(or {@code StringBuffer}
)
* class and its
<code>append</code>
method.
* class and its
{@code append}
method.
* String conversions are implemented through the method
* String conversions are implemented through the method
*
<code>toString</code>, defined by <code>Object</code>
and
*
{@code toString}, defined by {@code Object}
and
* inherited by all classes in Java. For additional information on
* inherited by all classes in Java. For additional information on
* string concatenation and conversion, see Gosling, Joy, and Steele,
* string concatenation and conversion, see Gosling, Joy, and Steele,
* <i>The Java Language Specification</i>.
* <i>The Java Language Specification</i>.
...
@@ -85,16 +85,16 @@ import java.util.regex.PatternSyntaxException;
...
@@ -85,16 +85,16 @@ import java.util.regex.PatternSyntaxException;
* or method in this class will cause a {@link NullPointerException} to be
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
* thrown.
*
*
* <p>A
<code>String</code>
represents a string in the UTF-16 format
* <p>A
{@code String}
represents a string in the UTF-16 format
* in which <em>supplementary characters</em> are represented by <em>surrogate
* in which <em>supplementary characters</em> are represented by <em>surrogate
* pairs</em> (see the section <a href="Character.html#unicode">Unicode
* pairs</em> (see the section <a href="Character.html#unicode">Unicode
* Character Representations</a> in the
<code>Character</code>
class for
* Character Representations</a> in the
{@code Character}
class for
* more information).
* more information).
* Index values refer to
<code>char</code>
code units, so a supplementary
* Index values refer to
{@code char}
code units, so a supplementary
* character uses two positions in a
<code>String</code>
.
* character uses two positions in a
{@code String}
.
* <p>The
<code>String</code>
class provides methods for dealing with
* <p>The
{@code String}
class provides methods for dealing with
* Unicode code points (i.e., characters), in addition to those for
* Unicode code points (i.e., characters), in addition to those for
* dealing with Unicode code units (i.e.,
<code>char</code>
values).
* dealing with Unicode code units (i.e.,
{@code char}
values).
*
*
* @author Lee Boynton
* @author Lee Boynton
* @author Arthur van Hoff
* @author Arthur van Hoff
...
@@ -131,9 +131,9 @@ public final class String
...
@@ -131,9 +131,9 @@ public final class String
* A String instance is written initially into an ObjectOutputStream in the
* A String instance is written initially into an ObjectOutputStream in the
* following format:
* following format:
* <pre>
* <pre>
*
<code>TC_STRING</code>
(utf String)
*
{@code TC_STRING}
(utf String)
* </pre>
* </pre>
* The String is written by method
<code>DataOutput.writeUTF</code>
.
* The String is written by method
{@code DataOutput.writeUTF}
.
* A new handle is generated to refer to all future references to the
* A new handle is generated to refer to all future references to the
* string instance within the stream.
* string instance within the stream.
*/
*/
...
@@ -673,20 +673,20 @@ public final class String
...
@@ -673,20 +673,20 @@ public final class String
}
}
/**
/**
* Returns the
<code>char</code>
value at the
* Returns the
{@code char}
value at the
* specified index. An index ranges from
<code>0</code>
to
* specified index. An index ranges from
{@code 0}
to
*
<code>length() - 1</code>. The first <code>char</code>
value of the sequence
*
{@code length() - 1}. The first {@code char}
value of the sequence
* is at index
<code>0</code>, the next at index <code>1</code>
,
* is at index
{@code 0}, the next at index {@code 1}
,
* and so on, as for array indexing.
* 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="Character.html#unicode">surrogate</a>, the surrogate
* <a href="Character.html#unicode">surrogate</a>, the surrogate
* value is returned.
* value is returned.
*
*
* @param index the index of the
<code>char</code>
value.
* @param index the index of the
{@code char}
value.
* @return the
<code>char</code>
value at the specified index of this string.
* @return the
{@code char}
value at the specified index of this string.
* The first
<code>char</code> value is at index <code>0</code>
.
* The first
{@code char} value is at index {@code 0}
.
* @exception IndexOutOfBoundsException if the
<code>index</code>
* @exception IndexOutOfBoundsException if the
{@code index}
* argument is negative or not less than the length of this
* argument is negative or not less than the length of this
* string.
* string.
*/
*/
...
@@ -699,22 +699,22 @@ public final class String
...
@@ -699,22 +699,22 @@ public final class String
/**
/**
* Returns the character (Unicode code point) at the specified
* Returns the character (Unicode code point) at the specified
* index. The index refers to
<code>char</code>
values
* index. The index refers to
{@code char}
values
* (Unicode code units) and ranges from
<code>0</code>
to
* (Unicode code units) and ranges from
{@code 0}
to
* {@link #length()}
<code> - 1</code>
.
* {@link #length()}
{@code - 1}
.
*
*
* <p> If the
<code>char</code>
value specified at the given index
* <p> If the
{@code char}
value specified at the given index
* is in the high-surrogate range, the following index is less
* is in the high-surrogate range, the following index is less
* than the length of this
<code>String</code>
, and the
* than the length of this
{@code String}
, and the
*
<code>char</code>
value at the following index is in the
*
{@code char}
value at the following index is in the
* low-surrogate range, then the supplementary code point
* low-surrogate range, then the supplementary code point
* corresponding to this surrogate pair is returned. Otherwise,
* corresponding to this surrogate pair is returned. Otherwise,
* the
<code>char</code>
value at the given index is returned.
* the
{@code char}
value at the given index is returned.
*
*
* @param index the index to the
<code>char</code>
values
* @param index the index to the
{@code char}
values
* @return the code point value of the character at the
* @return the code point value of the character at the
*
<code>index</code>
*
{@code index}
* @exception IndexOutOfBoundsException if the
<code>index</code>
* @exception IndexOutOfBoundsException if the
{@code index}
* argument is negative or not less than the length of this
* argument is negative or not less than the length of this
* string.
* string.
* @since 1.5
* @since 1.5
...
@@ -728,22 +728,22 @@ public final class String
...
@@ -728,22 +728,22 @@ public final class String
/**
/**
* Returns the character (Unicode code point) before the specified
* Returns the character (Unicode code point) before the specified
* index. The index refers to
<code>char</code>
values
* index. The index refers to
{@code char}
values
* (Unicode code units) and ranges from
<code>1</code>
to {@link
* (Unicode code units) and ranges from
{@code 1}
to {@link
* CharSequence#length() length}.
* CharSequence#length() length}.
*
*
* <p> If the
<code>char</code> value at <code>(index - 1)</code>
* <p> If the
{@code char} value at {@code (index - 1)}
* is in the low-surrogate range,
<code>(index - 2)</code>
is not
* is in the low-surrogate range,
{@code (index - 2)}
is not
* negative, and the
<code>char</code> value at <code>
(index -
* negative, and the
{@code char} value at {@code
(index -
* 2)
</code>
is in the high-surrogate range, then the
* 2)
}
is in the high-surrogate range, then the
* supplementary code point value of the surrogate pair is
* supplementary code point value of the surrogate pair is
* returned. If the
<code>char</code> value at <code>
index -
* returned. If the
{@code char} value at {@code
index -
* 1
</code>
is an unpaired low-surrogate or a high-surrogate, the
* 1
}
is an unpaired low-surrogate or a high-surrogate, the
* surrogate value is returned.
* surrogate value is returned.
*
*
* @param index the index following the code point that should be returned
* @param index the index following the code point that should be returned
* @return the Unicode code point value before the given index.
* @return the Unicode code point value before the given index.
* @exception IndexOutOfBoundsException if the
<code>index</code>
* @exception IndexOutOfBoundsException if the
{@code index}
* argument is less than 1 or greater than the length
* argument is less than 1 or greater than the length
* of this string.
* of this string.
* @since 1.5
* @since 1.5
...
@@ -758,23 +758,23 @@ public final class String
...
@@ -758,23 +758,23 @@ public final class String
/**
/**
* Returns the number of Unicode code points in the specified text
* Returns the number of Unicode code points in the specified text
* range of this
<code>String</code>
. The text range begins at the
* range of this
{@code String}
. The text range begins at the
* specified
<code>beginIndex</code>
and extends to the
* specified
{@code beginIndex}
and extends to the
*
<code>char</code> at index <code>endIndex - 1</code>
. Thus the
*
{@code char} at index {@code endIndex - 1}
. Thus the
* length (in
<code>char</code>
s) of the text range is
* length (in
{@code char}
s) of the text range is
*
<code>endIndex-beginIndex</code>
. Unpaired surrogates within
*
{@code endIndex-beginIndex}
. Unpaired surrogates within
* the text range count as one code point each.
* the text range count as one code point each.
*
*
* @param beginIndex the index to the first
<code>char</code>
of
* @param beginIndex the index to the first
{@code char}
of
* the text range.
* the text range.
* @param endIndex the index after the last
<code>char</code>
of
* @param endIndex the index after the last
{@code char}
of
* the text range.
* the text range.
* @return the number of Unicode code points in the specified text
* @return the number of Unicode code points in the specified text
* range
* range
* @exception IndexOutOfBoundsException if the
* @exception IndexOutOfBoundsException if the
*
<code>beginIndex</code> is negative, or <code>endIndex</code>
*
{@code beginIndex} is negative, or {@code endIndex}
* is larger than the length of this
<code>String</code>
, or
* is larger than the length of this
{@code String}
, or
*
<code>beginIndex</code> is larger than <code>endIndex</code>
.
*
{@code beginIndex} is larger than {@code endIndex}
.
* @since 1.5
* @since 1.5
*/
*/
public
int
codePointCount
(
int
beginIndex
,
int
endIndex
)
{
public
int
codePointCount
(
int
beginIndex
,
int
endIndex
)
{
...
@@ -785,23 +785,23 @@ public final class String
...
@@ -785,23 +785,23 @@ public final class String
}
}
/**
/**
* Returns the index within this
<code>String</code>
that is
* Returns the index within this
{@code String}
that is
* offset from the given
<code>index</code>
by
* offset from the given
{@code index}
by
*
<code>codePointOffset</code>
code points. Unpaired surrogates
*
{@code codePointOffset}
code points. Unpaired surrogates
* within the text range given by
<code>index</code>
and
* within the text range given by
{@code index}
and
*
<code>codePointOffset</code>
count as one code point each.
*
{@code codePointOffset}
count as one code point each.
*
*
* @param index the index to be offset
* @param index the index to be offset
* @param codePointOffset the offset in code points
* @param codePointOffset the offset in code points
* @return the index within this
<code>String</code>
* @return the index within this
{@code String}
* @exception IndexOutOfBoundsException if
<code>index</code>
* @exception IndexOutOfBoundsException if
{@code index}
* is negative or larger then the length of this
* is negative or larger then the length of this
*
<code>String</code>, or if <code>codePointOffset</code>
is positive
*
{@code String}, or if {@code codePointOffset}
is positive
* and the substring starting with
<code>index</code>
has fewer
* and the substring starting with
{@code index}
has fewer
* than
<code>codePointOffset</code>
code points,
* than
{@code codePointOffset}
code points,
* or if
<code>codePointOffset</code>
is negative and the substring
* or if
{@code codePointOffset}
is negative and the substring
* before
<code>index</code>
has fewer than the absolute value
* before
{@code index}
has fewer than the absolute value
* of
<code>codePointOffset</code>
code points.
* of
{@code codePointOffset}
code points.
* @since 1.5
* @since 1.5
*/
*/
public
int
offsetByCodePoints
(
int
index
,
int
codePointOffset
)
{
public
int
offsetByCodePoints
(
int
index
,
int
codePointOffset
)
{
...
@@ -824,11 +824,11 @@ public final class String
...
@@ -824,11 +824,11 @@ public final class String
* Copies characters from this string into the destination character
* Copies characters from this string into the destination character
* array.
* array.
* <p>
* <p>
* The first character to be copied is at index
<code>srcBegin</code>
;
* The first character to be copied is at index
{@code srcBegin}
;
* the last character to be copied is at index
<code>srcEnd-1</code>
* the last character to be copied is at index
{@code srcEnd-1}
* (thus the total number of characters to be copied is
* (thus the total number of characters to be copied is
*
<code>srcEnd-srcBegin</code>
). The characters are copied into the
*
{@code srcEnd-srcBegin}
). The characters are copied into the
* subarray of
<code>dst</code> starting at index <code>dstBegin</code>
* subarray of
{@code dst} starting at index {@code dstBegin}
* and ending at index:
* and ending at index:
* <p><blockquote><pre>
* <p><blockquote><pre>
* dstbegin + (srcEnd-srcBegin) - 1
* dstbegin + (srcEnd-srcBegin) - 1
...
@@ -842,13 +842,13 @@ public final class String
...
@@ -842,13 +842,13 @@ public final class String
* @param dstBegin the start offset in the destination array.
* @param dstBegin the start offset in the destination array.
* @exception IndexOutOfBoundsException If any of the following
* @exception IndexOutOfBoundsException If any of the following
* is true:
* is true:
* <ul><li>
<code>srcBegin</code>
is negative.
* <ul><li>
{@code srcBegin}
is negative.
* <li>
<code>srcBegin</code> is greater than <code>srcEnd</code>
* <li>
{@code srcBegin} is greater than {@code srcEnd}
* <li>
<code>srcEnd</code>
is greater than the length of this
* <li>
{@code srcEnd}
is greater than the length of this
* string
* string
* <li>
<code>dstBegin</code>
is negative
* <li>
{@code dstBegin}
is negative
* <li>
<code>dstBegin+(srcEnd-srcBegin)</code>
is larger than
* <li>
{@code dstBegin+(srcEnd-srcBegin)}
is larger than
*
<code>dst.length</code>
</ul>
*
{@code dst.length}
</ul>
*/
*/
public
void
getChars
(
int
srcBegin
,
int
srcEnd
,
char
dst
[],
int
dstBegin
)
{
public
void
getChars
(
int
srcBegin
,
int
srcEnd
,
char
dst
[],
int
dstBegin
)
{
if
(
srcBegin
<
0
)
{
if
(
srcBegin
<
0
)
{
...
@@ -1135,14 +1135,14 @@ public final class String
...
@@ -1135,14 +1135,14 @@ public final class String
* Compares two strings lexicographically.
* Compares two strings lexicographically.
* The comparison is based on the Unicode value of each character in
* The comparison is based on the Unicode value of each character in
* the strings. The character sequence represented by this
* the strings. The character sequence represented by this
*
<code>String</code>
object is compared lexicographically to the
*
{@code String}
object is compared lexicographically to the
* character sequence represented by the argument string. The result is
* character sequence represented by the argument string. The result is
* a negative integer if this
<code>String</code>
object
* a negative integer if this
{@code String}
object
* lexicographically precedes the argument string. The result is a
* lexicographically precedes the argument string. The result is a
* positive integer if this
<code>String</code>
object lexicographically
* positive integer if this
{@code String}
object lexicographically
* follows the argument string. The result is zero if the strings
* follows the argument string. The result is zero if the strings
* are equal;
<code>compareTo</code> returns <code>0</code>
exactly when
* are equal;
{@code compareTo} returns {@code 0}
exactly when
* the {@link #equals(Object)} method would return
<code>true</code>
.
* the {@link #equals(Object)} method would return
{@code true}
.
* <p>
* <p>
* This is the definition of lexicographic ordering. If two strings are
* This is the definition of lexicographic ordering. If two strings are
* different, then either they have different characters at some index
* different, then either they have different characters at some index
...
@@ -1151,25 +1151,25 @@ public final class String
...
@@ -1151,25 +1151,25 @@ public final class String
* positions, let <i>k</i> be the smallest such index; then the string
* 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
* whose character at position <i>k</i> has the smaller value, as
* determined by using the < operator, lexicographically precedes the
* determined by using the < operator, lexicographically precedes the
* other string. In this case,
<code>compareTo</code>
returns the
* other string. In this case,
{@code compareTo}
returns the
* difference of the two character values at position
<code>k</code>
in
* difference of the two character values at position
{@code k}
in
* the two string -- that is, the value:
* the two string -- that is, the value:
* <blockquote><pre>
* <blockquote><pre>
* this.charAt(k)-anotherString.charAt(k)
* this.charAt(k)-anotherString.charAt(k)
* </pre></blockquote>
* </pre></blockquote>
* If there is no index position at which they differ, then the shorter
* If there is no index position at which they differ, then the shorter
* string lexicographically precedes the longer string. In this case,
* string lexicographically precedes the longer string. In this case,
*
<code>compareTo</code>
returns the difference of the lengths of the
*
{@code compareTo}
returns the difference of the lengths of the
* strings -- that is, the value:
* strings -- that is, the value:
* <blockquote><pre>
* <blockquote><pre>
* this.length()-anotherString.length()
* this.length()-anotherString.length()
* </pre></blockquote>
* </pre></blockquote>
*
*
* @param anotherString the
<code>String</code>
to be compared.
* @param anotherString the
{@code String}
to be compared.
* @return the value
<code>0</code>
if the argument string is equal to
* @return the value
{@code 0}
if the argument string is equal to
* this string; a value less than
<code>0</code>
if this string
* this string; a value less than
{@code 0}
if this string
* is lexicographically less than the string argument; and a
* is lexicographically less than the string argument; and a
* value greater than
<code>0</code>
if this string is
* value greater than
{@code 0}
if this string is
* lexicographically greater than the string argument.
* lexicographically greater than the string argument.
*/
*/
public
int
compareTo
(
String
anotherString
)
{
public
int
compareTo
(
String
anotherString
)
{
...
@@ -1205,8 +1205,8 @@ public final class String
...
@@ -1205,8 +1205,8 @@ public final class String
}
}
/**
/**
* A Comparator that orders
<code>String</code>
objects as by
* A Comparator that orders
{@code String}
objects as by
*
<code>compareToIgnoreCase</code>
. This comparator is serializable.
*
{@code compareToIgnoreCase}
. This comparator is serializable.
* <p>
* <p>
* Note that this Comparator does <em>not</em> take locale into account,
* Note that this Comparator does <em>not</em> take locale into account,
* and will result in an unsatisfactory ordering for certain locales.
* and will result in an unsatisfactory ordering for certain locales.
...
@@ -1253,9 +1253,9 @@ public final class String
...
@@ -1253,9 +1253,9 @@ public final class String
/**
/**
* Compares two strings lexicographically, ignoring case
* Compares two strings lexicographically, ignoring case
* differences. This method returns an integer whose sign is that of
* differences. This method returns an integer whose sign is that of
* calling
<code>compareTo</code>
with normalized versions of the strings
* calling
{@code compareTo}
with normalized versions of the strings
* where case differences have been eliminated by calling
* where case differences have been eliminated by calling
*
<code>Character.toLowerCase(Character.toUpperCase(character))</code>
on
*
{@code Character.toLowerCase(Character.toUpperCase(character))}
on
* each character.
* each character.
* <p>
* <p>
* Note that this method does <em>not</em> take locale into account,
* Note that this method does <em>not</em> take locale into account,
...
@@ -1263,7 +1263,7 @@ public final class String
...
@@ -1263,7 +1263,7 @@ public final class String
* The java.text package provides <em>collators</em> to allow
* The java.text package provides <em>collators</em> to allow
* locale-sensitive ordering.
* locale-sensitive ordering.
*
*
* @param str the
<code>String</code>
to be compared.
* @param str the
{@code String}
to be compared.
* @return a negative integer, zero, or a positive integer as the
* @return a negative integer, zero, or a positive integer as the
* specified String is greater than, equal to, or less
* specified String is greater than, equal to, or less
* than this String, ignoring case considerations.
* than this String, ignoring case considerations.
...
@@ -1301,9 +1301,9 @@ public final class String
...
@@ -1301,9 +1301,9 @@ public final class String
* @param ooffset the starting offset of the subregion in the string
* @param ooffset the starting offset of the subregion in the string
* argument.
* argument.
* @param len the number of characters to compare.
* @param len the number of characters to compare.
* @return
<code>true</code>
if the specified subregion of this string
* @return
{@code true}
if the specified subregion of this string
* exactly matches the specified subregion of the string argument;
* exactly matches the specified subregion of the string argument;
*
<code>false</code>
otherwise.
*
{@code false}
otherwise.
*/
*/
public
boolean
regionMatches
(
int
toffset
,
String
other
,
int
ooffset
,
public
boolean
regionMatches
(
int
toffset
,
String
other
,
int
ooffset
,
int
len
)
{
int
len
)
{
...
@@ -1360,7 +1360,7 @@ public final class String
...
@@ -1360,7 +1360,7 @@ public final class String
* </pre></blockquote>
* </pre></blockquote>
* </ul>
* </ul>
*
*
* @param ignoreCase if
<code>true</code>
, ignore case when comparing
* @param ignoreCase if
{@code true}
, ignore case when comparing
* characters.
* characters.
* @param toffset the starting offset of the subregion in this
* @param toffset the starting offset of the subregion in this
* string.
* string.
...
@@ -1368,10 +1368,10 @@ public final class String
...
@@ -1368,10 +1368,10 @@ public final class String
* @param ooffset the starting offset of the subregion in the string
* @param ooffset the starting offset of the subregion in the string
* argument.
* argument.
* @param len the number of characters to compare.
* @param len the number of characters to compare.
* @return
<code>true</code>
if the specified subregion of this string
* @return
{@code true}
if the specified subregion of this string
* matches the specified subregion of the string argument;
* matches the specified subregion of the string argument;
*
<code>false</code>
otherwise. Whether the matching is exact
*
{@code false}
otherwise. Whether the matching is exact
* or case insensitive depends on the
<code>ignoreCase</code>
* or case insensitive depends on the
{@code ignoreCase}
* argument.
* argument.
*/
*/
public
boolean
regionMatches
(
boolean
ignoreCase
,
int
toffset
,
public
boolean
regionMatches
(
boolean
ignoreCase
,
int
toffset
,
...
@@ -1420,12 +1420,12 @@ public final class String
...
@@ -1420,12 +1420,12 @@ public final class String
*
*
* @param prefix the prefix.
* @param prefix the prefix.
* @param toffset where to begin looking in this string.
* @param toffset where to begin looking in this string.
* @return
<code>true</code>
if the character sequence represented by the
* @return
{@code true}
if the character sequence represented by the
* argument is a prefix of the substring of this object starting
* argument is a prefix of the substring of this object starting
* at index
<code>toffset</code>; <code>false</code>
otherwise.
* at index
{@code toffset}; {@code false}
otherwise.
* The result is
<code>false</code> if <code>toffset</code>
is
* The result is
{@code false} if {@code toffset}
is
* negative or greater than the length of this
* negative or greater than the length of this
*
<code>String</code>
object; otherwise the result is the same
*
{@code String}
object; otherwise the result is the same
* as the result of the expression
* as the result of the expression
* <pre>
* <pre>
* this.substring(toffset).startsWith(prefix)
* this.substring(toffset).startsWith(prefix)
...
@@ -1453,12 +1453,12 @@ public final class String
...
@@ -1453,12 +1453,12 @@ public final class String
* Tests if this string starts with the specified prefix.
* Tests if this string starts with the specified prefix.
*
*
* @param prefix the prefix.
* @param prefix the prefix.
* @return
<code>true</code>
if the character sequence represented by the
* @return
{@code true}
if the character sequence represented by the
* argument is a prefix of the character sequence represented by
* argument is a prefix of the character sequence represented by
* this string;
<code>false</code>
otherwise.
* this string;
{@code false}
otherwise.
* Note also that
<code>true</code>
will be returned if the
* Note also that
{@code true}
will be returned if the
* argument is an empty string or is equal to this
* argument is an empty string or is equal to this
*
<code>String</code>
object as determined by the
*
{@code String}
object as determined by the
* {@link #equals(Object)} method.
* {@link #equals(Object)} method.
* @since 1. 0
* @since 1. 0
*/
*/
...
@@ -1470,11 +1470,11 @@ public final class String
...
@@ -1470,11 +1470,11 @@ public final class String
* Tests if this string ends with the specified suffix.
* Tests if this string ends with the specified suffix.
*
*
* @param suffix the suffix.
* @param suffix the suffix.
* @return
<code>true</code>
if the character sequence represented by the
* @return
{@code true}
if the character sequence represented by the
* argument is a suffix of the character sequence represented by
* argument is a suffix of the character sequence represented by
* this object;
<code>false</code>
otherwise. Note that the
* this object;
{@code false}
otherwise. Note that the
* result will be
<code>true</code>
if the argument is the
* result will be
{@code true}
if the argument is the
* empty string or is equal to this
<code>String</code>
object
* empty string or is equal to this
{@code String}
object
* as determined by the {@link #equals(Object)} method.
* as determined by the {@link #equals(Object)} method.
*/
*/
public
boolean
endsWith
(
String
suffix
)
{
public
boolean
endsWith
(
String
suffix
)
{
...
@@ -1483,13 +1483,13 @@ public final class String
...
@@ -1483,13 +1483,13 @@ public final class String
/**
/**
* Returns a hash code for this string. The hash code for a
* Returns a hash code for this string. The hash code for a
*
<code>String</code>
object is computed as
*
{@code String}
object is computed as
* <blockquote><pre>
* <blockquote><pre>
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
* </pre></blockquote>
* </pre></blockquote>
* using
<code>int</code> arithmetic, where <code>s[i]</code>
is the
* using
{@code int} arithmetic, where {@code s[i]}
is the
* <i>i</i>th character of the string,
<code>n</code>
is the length of
* <i>i</i>th character of the string,
{@code n}
is the length of
* the string, and
<code>^</code>
indicates exponentiation.
* the string, and
{@code ^}
indicates exponentiation.
* (The hash value of the empty string is zero.)
* (The hash value of the empty string is zero.)
*
*
* @return a hash code value for this object.
* @return a hash code value for this object.
...
@@ -1512,26 +1512,26 @@ public final class String
...
@@ -1512,26 +1512,26 @@ public final class String
/**
/**
* Returns the index within this string of the first occurrence of
* Returns the index within this string of the first occurrence of
* the specified character. If a character with value
* the specified character. If a character with value
*
<code>ch</code>
occurs in the character sequence represented by
*
{@code ch}
occurs in the character sequence represented by
* this
<code>String</code>
object, then the index (in Unicode
* this
{@code String}
object, then the index (in Unicode
* code units) of the first such occurrence is returned. For
* code units) of the first such occurrence is returned. For
* values of
<code>ch</code>
in the range from 0 to 0xFFFF
* values of
{@code ch}
in the range from 0 to 0xFFFF
* (inclusive), this is the smallest value <i>k</i> such that:
* (inclusive), this is the smallest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* this.charAt(<i>k</i>) == ch
* this.charAt(<i>k</i>) == ch
* </pre></blockquote>
* </pre></blockquote>
* is true. For other values of
<code>ch</code>
, it is the
* is true. For other values of
{@code ch}
, it is the
* smallest value <i>k</i> such that:
* smallest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* this.codePointAt(<i>k</i>) == ch
* this.codePointAt(<i>k</i>) == ch
* </pre></blockquote>
* </pre></blockquote>
* is true. In either case, if no such character occurs in this
* is true. In either case, if no such character occurs in this
* string, then
<code>-1</code>
is returned.
* string, then
{@code -1}
is returned.
*
*
* @param ch a character (Unicode code point).
* @param ch a character (Unicode code point).
* @return the index of the first occurrence of the character in the
* @return the index of the first occurrence of the character in the
* character sequence represented by this object, or
* character sequence represented by this object, or
*
<code>-1</code>
if the character does not occur.
*
{@code -1}
if the character does not occur.
*/
*/
public
int
indexOf
(
int
ch
)
{
public
int
indexOf
(
int
ch
)
{
return
indexOf
(
ch
,
0
);
return
indexOf
(
ch
,
0
);
...
@@ -1541,39 +1541,39 @@ public final class String
...
@@ -1541,39 +1541,39 @@ public final class String
* Returns the index within this string of the first occurrence of the
* Returns the index within this string of the first occurrence of the
* specified character, starting the search at the specified index.
* specified character, starting the search at the specified index.
* <p>
* <p>
* If a character with value
<code>ch</code>
occurs in the
* If a character with value
{@code ch}
occurs in the
* character sequence represented by this
<code>String</code>
* character sequence represented by this
{@code String}
* object at an index no smaller than
<code>fromIndex</code>
, then
* object at an index no smaller than
{@code fromIndex}
, then
* the index of the first such occurrence is returned. For values
* the index of the first such occurrence is returned. For values
* of
<code>ch</code>
in the range from 0 to 0xFFFF (inclusive),
* of
{@code ch}
in the range from 0 to 0xFFFF (inclusive),
* this is the smallest value <i>k</i> such that:
* this is the smallest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
* (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. For other values of
<code>ch</code>
, it is the
* is true. For other values of
{@code ch}
, it is the
* smallest value <i>k</i> such that:
* smallest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.codePointAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
* (this.codePointAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. In either case, if no such character occurs in this
* is true. In either case, if no such character occurs in this
* string at or after position
<code>fromIndex</code>
, then
* string at or after position
{@code fromIndex}
, then
*
<code>-1</code>
is returned.
*
{@code -1}
is returned.
*
*
* <p>
* <p>
* There is no restriction on the value of
<code>fromIndex</code>
. If it
* There is no restriction on the value of
{@code fromIndex}
. If it
* is negative, it has the same effect as if it were zero: this entire
* is negative, it has the same effect as if it were zero: this entire
* string may be searched. If it is greater than the length of this
* string may be searched. If it is greater than the length of this
* string, it has the same effect as if it were equal to the length of
* string, it has the same effect as if it were equal to the length of
* this string:
<code>-1</code>
is returned.
* this string:
{@code -1}
is returned.
*
*
* <p>All indices are specified in
<code>char</code>
values
* <p>All indices are specified in
{@code char}
values
* (Unicode code units).
* (Unicode code units).
*
*
* @param ch a character (Unicode code point).
* @param ch a character (Unicode code point).
* @param fromIndex the index to start the search from.
* @param fromIndex the index to start the search from.
* @return the index of the first occurrence of the character in the
* @return the index of the first occurrence of the character in the
* character sequence represented by this object that is greater
* character sequence represented by this object that is greater
* than or equal to
<code>fromIndex</code>, or <code>-1</code>
* than or equal to
{@code fromIndex}, or {@code -1}
* if the character does not occur.
* if the character does not occur.
*/
*/
public
int
indexOf
(
int
ch
,
int
fromIndex
)
{
public
int
indexOf
(
int
ch
,
int
fromIndex
)
{
...
@@ -1622,26 +1622,26 @@ public final class String
...
@@ -1622,26 +1622,26 @@ public final class String
/**
/**
* Returns the index within this string of the last occurrence of
* Returns the index within this string of the last occurrence of
* the specified character. For values of
<code>ch</code>
in the
* the specified character. For values of
{@code ch}
in the
* range from 0 to 0xFFFF (inclusive), the index (in Unicode code
* range from 0 to 0xFFFF (inclusive), the index (in Unicode code
* units) returned is the largest value <i>k</i> such that:
* units) returned is the largest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* this.charAt(<i>k</i>) == ch
* this.charAt(<i>k</i>) == ch
* </pre></blockquote>
* </pre></blockquote>
* is true. For other values of
<code>ch</code>
, it is the
* is true. For other values of
{@code ch}
, it is the
* largest value <i>k</i> such that:
* largest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* this.codePointAt(<i>k</i>) == ch
* this.codePointAt(<i>k</i>) == ch
* </pre></blockquote>
* </pre></blockquote>
* is true. In either case, if no such character occurs in this
* is true. In either case, if no such character occurs in this
* string, then
<code>-1</code>
is returned. The
* string, then
{@code -1}
is returned. The
*
<code>String</code>
is searched backwards starting at the last
*
{@code String}
is searched backwards starting at the last
* character.
* character.
*
*
* @param ch a character (Unicode code point).
* @param ch a character (Unicode code point).
* @return the index of the last occurrence of the character in the
* @return the index of the last occurrence of the character in the
* character sequence represented by this object, or
* character sequence represented by this object, or
*
<code>-1</code>
if the character does not occur.
*
{@code -1}
if the character does not occur.
*/
*/
public
int
lastIndexOf
(
int
ch
)
{
public
int
lastIndexOf
(
int
ch
)
{
return
lastIndexOf
(
ch
,
count
-
1
);
return
lastIndexOf
(
ch
,
count
-
1
);
...
@@ -1650,27 +1650,27 @@ public final class String
...
@@ -1650,27 +1650,27 @@ public final class String
/**
/**
* Returns the index within this string of the last occurrence of
* Returns the index within this string of the last occurrence of
* the specified character, searching backward starting at the
* the specified character, searching backward starting at the
* specified index. For values of
<code>ch</code>
in the range
* specified index. For values of
{@code ch}
in the range
* from 0 to 0xFFFF (inclusive), the index returned is the largest
* from 0 to 0xFFFF (inclusive), the index returned is the largest
* value <i>k</i> such that:
* value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.charAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
* (this.charAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. For other values of
<code>ch</code>
, it is the
* is true. For other values of
{@code ch}
, it is the
* largest value <i>k</i> such that:
* largest value <i>k</i> such that:
* <blockquote><pre>
* <blockquote><pre>
* (this.codePointAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
* (this.codePointAt(<i>k</i>) == ch) && (<i>k</i> <= fromIndex)
* </pre></blockquote>
* </pre></blockquote>
* is true. In either case, if no such character occurs in this
* is true. In either case, if no such character occurs in this
* string at or before position
<code>fromIndex</code>
, then
* string at or before position
{@code fromIndex}
, then
*
<code>-1</code>
is returned.
*
{@code -1}
is returned.
*
*
* <p>All indices are specified in
<code>char</code>
values
* <p>All indices are specified in
{@code char}
values
* (Unicode code units).
* (Unicode code units).
*
*
* @param ch a character (Unicode code point).
* @param ch a character (Unicode code point).
* @param fromIndex the index to start the search from. There is no
* @param fromIndex the index to start the search from. There is no
* restriction on the value of
<code>fromIndex</code>
. If it is
* restriction on the value of
{@code fromIndex}
. If it is
* greater than or equal to the length of this string, it has
* greater than or equal to the length of this string, it has
* the same effect as if it were equal to one less than the
* the same effect as if it were equal to one less than the
* length of this string: this entire string may be searched.
* length of this string: this entire string may be searched.
...
@@ -1678,7 +1678,7 @@ public final class String
...
@@ -1678,7 +1678,7 @@ public final class String
* -1 is returned.
* -1 is returned.
* @return the index of the last occurrence of the character in the
* @return the index of the last occurrence of the character in the
* character sequence represented by this object that is less
* character sequence represented by this object that is less
* than or equal to
<code>fromIndex</code>, or <code>-1</code>
* than or equal to
{@code fromIndex}, or {@code -1}
* if the character does not occur before that point.
* if the character does not occur before that point.
*/
*/
public
int
lastIndexOf
(
int
ch
,
int
fromIndex
)
{
public
int
lastIndexOf
(
int
ch
,
int
fromIndex
)
{
...
@@ -1921,8 +1921,8 @@ public final class String
...
@@ -1921,8 +1921,8 @@ public final class String
* @param beginIndex the beginning index, inclusive.
* @param beginIndex the beginning index, inclusive.
* @return the specified substring.
* @return the specified substring.
* @exception IndexOutOfBoundsException if
* @exception IndexOutOfBoundsException if
*
<code>beginIndex</code>
is negative or larger than the
*
{@code beginIndex}
is negative or larger than the
* length of this
<code>String</code>
object.
* length of this
{@code String}
object.
*/
*/
public
String
substring
(
int
beginIndex
)
{
public
String
substring
(
int
beginIndex
)
{
return
substring
(
beginIndex
,
count
);
return
substring
(
beginIndex
,
count
);
...
@@ -1930,9 +1930,9 @@ public final class String
...
@@ -1930,9 +1930,9 @@ public final class String
/**
/**
* Returns a new string that is a substring of this string. The
* Returns a new string that is a substring of this string. The
* substring begins at the specified
<code>beginIndex</code>
and
* substring begins at the specified
{@code beginIndex}
and
* extends to the character at index
<code>endIndex - 1</code>
.
* extends to the character at index
{@code endIndex - 1}
.
* Thus the length of the substring is
<code>endIndex-beginIndex</code>
.
* Thus the length of the substring is
{@code endIndex-beginIndex}
.
* <p>
* <p>
* Examples:
* Examples:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -1944,11 +1944,11 @@ public final class String
...
@@ -1944,11 +1944,11 @@ public final class String
* @param endIndex the ending index, exclusive.
* @param endIndex the ending index, exclusive.
* @return the specified substring.
* @return the specified substring.
* @exception IndexOutOfBoundsException if the
* @exception IndexOutOfBoundsException if the
*
<code>beginIndex</code>
is negative, or
*
{@code beginIndex}
is negative, or
*
<code>endIndex</code>
is larger than the length of
*
{@code endIndex}
is larger than the length of
* this
<code>String</code>
object, or
* this
{@code String}
object, or
*
<code>beginIndex</code>
is larger than
*
{@code beginIndex}
is larger than
*
<code>endIndex</code>
.
*
{@code endIndex}
.
*/
*/
public
String
substring
(
int
beginIndex
,
int
endIndex
)
{
public
String
substring
(
int
beginIndex
,
int
endIndex
)
{
if
(
beginIndex
<
0
)
{
if
(
beginIndex
<
0
)
{
...
@@ -1999,11 +1999,11 @@ public final class String
...
@@ -1999,11 +1999,11 @@ public final class String
/**
/**
* Concatenates the specified string to the end of this string.
* Concatenates the specified string to the end of this string.
* <p>
* <p>
* If the length of the argument string is
<code>0</code>
, then this
* If the length of the argument string is
{@code 0}
, then this
*
<code>String</code>
object is returned. Otherwise, a new
*
{@code String}
object is returned. Otherwise, a new
*
<code>String</code>
object is created, representing a character
*
{@code String}
object is created, representing a character
* sequence that is the concatenation of the character sequence
* sequence that is the concatenation of the character sequence
* represented by this
<code>String</code>
object and the character
* represented by this
{@code String}
object and the character
* sequence represented by the argument string.<p>
* sequence represented by the argument string.<p>
* Examples:
* Examples:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -2011,8 +2011,8 @@ public final class String
...
@@ -2011,8 +2011,8 @@ public final class String
* "to".concat("get").concat("her") returns "together"
* "to".concat("get").concat("her") returns "together"
* </pre></blockquote>
* </pre></blockquote>
*
*
* @param str the
<code>String</code>
that is concatenated to the end
* @param str the
{@code String}
that is concatenated to the end
* of this
<code>String</code>
.
* of this
{@code String}
.
* @return a string that represents the concatenation of this object's
* @return a string that represents the concatenation of this object's
* characters followed by the string argument's characters.
* characters followed by the string argument's characters.
*/
*/
...
@@ -2029,16 +2029,16 @@ public final class String
...
@@ -2029,16 +2029,16 @@ public final class String
/**
/**
* Returns a new string resulting from replacing all occurrences of
* Returns a new string resulting from replacing all occurrences of
*
<code>oldChar</code> in this string with <code>newChar</code>
.
*
{@code oldChar} in this string with {@code newChar}
.
* <p>
* <p>
* If the character
<code>oldChar</code>
does not occur in the
* If the character
{@code oldChar}
does not occur in the
* character sequence represented by this
<code>String</code>
object,
* character sequence represented by this
{@code String}
object,
* then a reference to this
<code>String</code>
object is returned.
* then a reference to this
{@code String}
object is returned.
* Otherwise, a new
<code>String</code>
object is created that
* Otherwise, a new
{@code String}
object is created that
* represents a character sequence identical to the character sequence
* represents a character sequence identical to the character sequence
* represented by this
<code>String</code>
object, except that every
* represented by this
{@code String}
object, except that every
* occurrence of
<code>oldChar</code>
is replaced by an occurrence
* occurrence of
{@code oldChar}
is replaced by an occurrence
* of
<code>newChar</code>
.
* of
{@code newChar}
.
* <p>
* <p>
* Examples:
* Examples:
* <blockquote><pre>
* <blockquote><pre>
...
@@ -2054,7 +2054,7 @@ public final class String
...
@@ -2054,7 +2054,7 @@ public final class String
* @param oldChar the old character.
* @param oldChar the old character.
* @param newChar the new character.
* @param newChar the new character.
* @return a string derived from this string by replacing every
* @return a string derived from this string by replacing every
* occurrence of
<code>oldChar</code> with <code>newChar</code>
.
* occurrence of
{@code oldChar} with {@code newChar}
.
*/
*/
public
String
replace
(
char
oldChar
,
char
newChar
)
{
public
String
replace
(
char
oldChar
,
char
newChar
)
{
if
(
oldChar
!=
newChar
)
{
if
(
oldChar
!=
newChar
)
{
...
@@ -2119,8 +2119,8 @@ public final class String
...
@@ -2119,8 +2119,8 @@ public final class String
* sequence of char values.
* sequence of char values.
*
*
* @param s the sequence to search for
* @param s the sequence to search for
* @return true if this string contains
<code>s</code>
, false otherwise
* @return true if this string contains
{@code s}
, false otherwise
* @throws NullPointerException if
<code>s</code> is <code>null</code>
* @throws NullPointerException if
{@code s} is {@code null}
* @since 1.5
* @since 1.5
*/
*/
public
boolean
contains
(
CharSequence
s
)
{
public
boolean
contains
(
CharSequence
s
)
{
...
@@ -2223,8 +2223,8 @@ public final class String
...
@@ -2223,8 +2223,8 @@ public final class String
* @param target The sequence of char values to be replaced
* @param target The sequence of char values to be replaced
* @param replacement The replacement sequence of char values
* @param replacement The replacement sequence of char values
* @return The resulting string
* @return The resulting string
* @throws NullPointerException if
<code>target</code>
or
* @throws NullPointerException if
{@code target}
or
*
<code>replacement</code> is <code>null</code>
.
*
{@code replacement} is {@code null}
.
* @since 1.5
* @since 1.5
*/
*/
public
String
replace
(
CharSequence
target
,
CharSequence
replacement
)
{
public
String
replace
(
CharSequence
target
,
CharSequence
replacement
)
{
...
@@ -2407,11 +2407,11 @@ public final class String
...
@@ -2407,11 +2407,11 @@ public final class String
}
}
/**
/**
* Converts all of the characters in this
<code>String</code>
to lower
* Converts all of the characters in this
{@code String}
to lower
* case using the rules of the given
<code>Locale</code>
. Case mapping is based
* case using the rules of the given
{@code Locale}
. Case mapping is based
* on the Unicode Standard version specified by the {@link java.lang.Character Character}
* on the Unicode Standard version specified by the {@link java.lang.Character Character}
* class. Since case mappings are not always 1:1 char mappings, the resulting
* class. Since case mappings are not always 1:1 char mappings, the resulting
*
<code>String</code> may be a different length than the original <code>String</code>
.
*
{@code String} may be a different length than the original {@code String}
.
* <p>
* <p>
* Examples of lowercase mappings are in the following table:
* Examples of lowercase mappings are in the following table:
* <table border="1" summary="Lowercase mapping examples showing language code of locale, upper case, lower case, and description">
* <table border="1" summary="Lowercase mapping examples showing language code of locale, upper case, lower case, and description">
...
@@ -2452,7 +2452,7 @@ public final class String
...
@@ -2452,7 +2452,7 @@ public final class String
* </table>
* </table>
*
*
* @param locale use the case transformation rules for this locale
* @param locale use the case transformation rules for this locale
* @return the
<code>String</code>
, converted to lowercase.
* @return the
{@code String}
, converted to lowercase.
* @see java.lang.String#toLowerCase()
* @see java.lang.String#toLowerCase()
* @see java.lang.String#toUpperCase()
* @see java.lang.String#toUpperCase()
* @see java.lang.String#toUpperCase(Locale)
* @see java.lang.String#toUpperCase(Locale)
...
@@ -2553,22 +2553,22 @@ public final class String
...
@@ -2553,22 +2553,22 @@ public final class String
}
}
/**
/**
* Converts all of the characters in this
<code>String</code>
to lower
* Converts all of the characters in this
{@code String}
to lower
* case using the rules of the default locale. This is equivalent to calling
* case using the rules of the default locale. This is equivalent to calling
*
<code>toLowerCase(Locale.getDefault())</code>
.
*
{@code toLowerCase(Locale.getDefault())}
.
* <p>
* <p>
* <b>Note:</b> This method is locale sensitive, and may produce unexpected
* <b>Note:</b> This method is locale sensitive, and may produce unexpected
* results if used for strings that are intended to be interpreted locale
* results if used for strings that are intended to be interpreted locale
* independently.
* independently.
* Examples are programming language identifiers, protocol keys, and HTML
* Examples are programming language identifiers, protocol keys, and HTML
* tags.
* tags.
* For instance,
<code>"TITLE".toLowerCase()</code>
in a Turkish locale
* For instance,
{@code "TITLE".toLowerCase()}
in a Turkish locale
* returns
<code>"t\u005Cu0131tle"</code>
, where '\u005Cu0131' is the
* returns
{@code "t\u005Cu0131tle"}
, where '\u005Cu0131' is the
* LATIN SMALL LETTER DOTLESS I character.
* LATIN SMALL LETTER DOTLESS I character.
* To obtain correct results for locale insensitive strings, use
* To obtain correct results for locale insensitive strings, use
*
<code>toLowerCase(Locale.ENGLISH)</code>
.
*
{@code toLowerCase(Locale.ENGLISH)}
.
* <p>
* <p>
* @return the
<code>String</code>
, converted to lowercase.
* @return the
{@code String}
, converted to lowercase.
* @see java.lang.String#toLowerCase(Locale)
* @see java.lang.String#toLowerCase(Locale)
*/
*/
public
String
toLowerCase
()
{
public
String
toLowerCase
()
{
...
@@ -2576,11 +2576,11 @@ public final class String
...
@@ -2576,11 +2576,11 @@ public final class String
}
}
/**
/**
* Converts all of the characters in this
<code>String</code>
to upper
* Converts all of the characters in this
{@code String}
to upper
* case using the rules of the given
<code>Locale</code>
. Case mapping is based
* case using the rules of the given
{@code Locale}
. Case mapping is based
* on the Unicode Standard version specified by the {@link java.lang.Character Character}
* on the Unicode Standard version specified by the {@link java.lang.Character Character}
* class. Since case mappings are not always 1:1 char mappings, the resulting
* class. Since case mappings are not always 1:1 char mappings, the resulting
*
<code>String</code> may be a different length than the original <code>String</code>
.
*
{@code String} may be a different length than the original {@code String}
.
* <p>
* <p>
* Examples of locale-sensitive and 1:M case mappings are in the following table.
* Examples of locale-sensitive and 1:M case mappings are in the following table.
* <p>
* <p>
...
@@ -2617,7 +2617,7 @@ public final class String
...
@@ -2617,7 +2617,7 @@ public final class String
* </tr>
* </tr>
* </table>
* </table>
* @param locale use the case transformation rules for this locale
* @param locale use the case transformation rules for this locale
* @return the
<code>String</code>
, converted to uppercase.
* @return the
{@code String}
, converted to uppercase.
* @see java.lang.String#toUpperCase()
* @see java.lang.String#toUpperCase()
* @see java.lang.String#toLowerCase()
* @see java.lang.String#toLowerCase()
* @see java.lang.String#toLowerCase(Locale)
* @see java.lang.String#toLowerCase(Locale)
...
@@ -2716,22 +2716,22 @@ public final class String
...
@@ -2716,22 +2716,22 @@ public final class String
}
}
/**
/**
* Converts all of the characters in this
<code>String</code>
to upper
* Converts all of the characters in this
{@code String}
to upper
* case using the rules of the default locale. This method is equivalent to
* case using the rules of the default locale. This method is equivalent to
*
<code>toUpperCase(Locale.getDefault())</code>
.
*
{@code toUpperCase(Locale.getDefault())}
.
* <p>
* <p>
* <b>Note:</b> This method is locale sensitive, and may produce unexpected
* <b>Note:</b> This method is locale sensitive, and may produce unexpected
* results if used for strings that are intended to be interpreted locale
* results if used for strings that are intended to be interpreted locale
* independently.
* independently.
* Examples are programming language identifiers, protocol keys, and HTML
* Examples are programming language identifiers, protocol keys, and HTML
* tags.
* tags.
* For instance,
<code>"title".toUpperCase()</code>
in a Turkish locale
* For instance,
{@code "title".toUpperCase()}
in a Turkish locale
* returns
<code>"T\u005Cu0130TLE"</code>
, where '\u005Cu0130' is the
* returns
{@code "T\u005Cu0130TLE"}
, where '\u005Cu0130' is the
* LATIN CAPITAL LETTER I WITH DOT ABOVE character.
* LATIN CAPITAL LETTER I WITH DOT ABOVE character.
* To obtain correct results for locale insensitive strings, use
* To obtain correct results for locale insensitive strings, use
*
<code>toUpperCase(Locale.ENGLISH)</code>
.
*
{@code toUpperCase(Locale.ENGLISH)}
.
* <p>
* <p>
* @return the
<code>String</code>
, converted to uppercase.
* @return the
{@code String}
, converted to uppercase.
* @see java.lang.String#toUpperCase(Locale)
* @see java.lang.String#toUpperCase(Locale)
*/
*/
public
String
toUpperCase
()
{
public
String
toUpperCase
()
{
...
@@ -2742,21 +2742,21 @@ public final class String
...
@@ -2742,21 +2742,21 @@ public final class String
* Returns a copy of the string, with leading and trailing whitespace
* Returns a copy of the string, with leading and trailing whitespace
* omitted.
* omitted.
* <p>
* <p>
* If this
<code>String</code>
object represents an empty character
* If this
{@code String}
object represents an empty character
* sequence, or the first and last characters of character sequence
* sequence, or the first and last characters of character sequence
* represented by this
<code>String</code>
object both have codes
* represented by this
{@code String}
object both have codes
* greater than
<code>'\u0020'</code>
(the space character), then a
* greater than
{@code '\u005Cu0020'}
(the space character), then a
* reference to this
<code>String</code>
object is returned.
* reference to this
{@code String}
object is returned.
* <p>
* <p>
* Otherwise, if there is no character with a code greater than
* Otherwise, if there is no character with a code greater than
*
<code>'\u0020'</code>
in the string, then a new
*
{@code '\u005Cu0020'}
in the string, then a new
*
<code>String</code>
object representing an empty string is created
*
{@code String}
object representing an empty string is created
* and returned.
* and returned.
* <p>
* <p>
* Otherwise, let <i>k</i> be the index of the first character in the
* Otherwise, let <i>k</i> be the index of the first character in the
* string whose code is greater than
<code>'\u0020'</code>
, and let
* string whose code is greater than
{@code '\u005Cu0020'}
, and let
* <i>m</i> be the index of the last character in the string whose code
* <i>m</i> be the index of the last character in the string whose code
* is greater than
<code>'\u0020'</code>. A new <code>String</code>
* is greater than
{@code '\u005Cu0020'}. A new {@code String}
* object is created, representing the substring of this string that
* object is created, representing the substring of this string that
* begins with the character at index <i>k</i> and ends with the
* begins with the character at index <i>k</i> and ends with the
* character at index <i>m</i>-that is, the result of
* character at index <i>m</i>-that is, the result of
...
@@ -2893,12 +2893,12 @@ public final class String
...
@@ -2893,12 +2893,12 @@ public final class String
}
}
/**
/**
* Returns the string representation of the
<code>Object</code>
argument.
* Returns the string representation of the
{@code Object}
argument.
*
*
* @param obj an
<code>Object</code>
.
* @param obj an
{@code Object}
.
* @return if the argument is
<code>null</code>
, then a string equal to
* @return if the argument is
{@code null}
, then a string equal to
*
<code>"null"</code>
; otherwise, the value of
*
{@code "null"}
; otherwise, the value of
*
<code>obj.toString()</code>
is returned.
*
{@code obj.toString()}
is returned.
* @see java.lang.Object#toString()
* @see java.lang.Object#toString()
*/
*/
public
static
String
valueOf
(
Object
obj
)
{
public
static
String
valueOf
(
Object
obj
)
{
...
@@ -2906,12 +2906,12 @@ public final class String
...
@@ -2906,12 +2906,12 @@ public final class String
}
}
/**
/**
* Returns the string representation of the
<code>char</code>
array
* Returns the string representation of the
{@code char}
array
* argument. The contents of the character array are copied; subsequent
* argument. The contents of the character array are copied; subsequent
* modification of the character array does not affect the newly
* modification of the character array does not affect the newly
* created string.
* created string.
*
*
* @param data a
<code>char</code>
array.
* @param data a
{@code char}
array.
* @return a newly allocated string representing the same sequence of
* @return a newly allocated string representing the same sequence of
* characters contained in the character array argument.
* characters contained in the character array argument.
*/
*/
...
@@ -2921,24 +2921,24 @@ public final class String
...
@@ -2921,24 +2921,24 @@ public final class String
/**
/**
* Returns the string representation of a specific subarray of the
* Returns the string representation of a specific subarray of the
*
<code>char</code>
array argument.
*
{@code char}
array argument.
* <p>
* <p>
* The
<code>offset</code>
argument is the index of the first
* The
{@code offset}
argument is the index of the first
* character of the subarray. The
<code>count</code>
argument
* character of the subarray. The
{@code count}
argument
* specifies the length of the subarray. The contents of the subarray
* specifies the length of the subarray. The contents of the subarray
* are copied; subsequent modification of the character array does not
* are copied; subsequent modification of the character array does not
* affect the newly created string.
* affect the newly created string.
*
*
* @param data the character array.
* @param data the character array.
* @param offset the initial offset into the value of the
* @param offset the initial offset into the value of the
*
<code>String</code>
.
*
{@code String}
.
* @param count the length of the value of the
<code>String</code>
.
* @param count the length of the value of the
{@code String}
.
* @return a string representing the sequence of characters contained
* @return a string representing the sequence of characters contained
* in the subarray of the character array argument.
* in the subarray of the character array argument.
* @exception IndexOutOfBoundsException if
<code>offset</code>
is
* @exception IndexOutOfBoundsException if
{@code offset}
is
* negative, or
<code>count</code>
is negative, or
* negative, or
{@code count}
is negative, or
*
<code>offset+count</code>
is larger than
*
{@code offset+count}
is larger than
*
<code>data.length</code>
.
*
{@code data.length}
.
*/
*/
public
static
String
valueOf
(
char
data
[],
int
offset
,
int
count
)
{
public
static
String
valueOf
(
char
data
[],
int
offset
,
int
count
)
{
return
new
String
(
data
,
offset
,
count
);
return
new
String
(
data
,
offset
,
count
);
...
@@ -2951,7 +2951,7 @@ public final class String
...
@@ -2951,7 +2951,7 @@ public final class String
* @param data the character array.
* @param data the character array.
* @param offset initial offset of the subarray.
* @param offset initial offset of the subarray.
* @param count length of the subarray.
* @param count length of the subarray.
* @return a
<code>String</code>
that contains the characters of the
* @return a
{@code String}
that contains the characters of the
* specified subarray of the character array.
* specified subarray of the character array.
*/
*/
public
static
String
copyValueOf
(
char
data
[],
int
offset
,
int
count
)
{
public
static
String
copyValueOf
(
char
data
[],
int
offset
,
int
count
)
{
...
@@ -2964,7 +2964,7 @@ public final class String
...
@@ -2964,7 +2964,7 @@ public final class String
* array specified.
* array specified.
*
*
* @param data the character array.
* @param data the character array.
* @return a
<code>String</code>
that contains the characters of the
* @return a
{@code String}
that contains the characters of the
* character array.
* character array.
*/
*/
public
static
String
copyValueOf
(
char
data
[])
{
public
static
String
copyValueOf
(
char
data
[])
{
...
@@ -2972,24 +2972,24 @@ public final class String
...
@@ -2972,24 +2972,24 @@ public final class String
}
}
/**
/**
* Returns the string representation of the
<code>boolean</code>
argument.
* Returns the string representation of the
{@code boolean}
argument.
*
*
* @param b a
<code>boolean</code>
.
* @param b a
{@code boolean}
.
* @return if the argument is
<code>true</code>
, a string equal to
* @return if the argument is
{@code true}
, a string equal to
*
<code>"true"</code>
is returned; otherwise, a string equal to
*
{@code "true"}
is returned; otherwise, a string equal to
*
<code>"false"</code>
is returned.
*
{@code "false"}
is returned.
*/
*/
public
static
String
valueOf
(
boolean
b
)
{
public
static
String
valueOf
(
boolean
b
)
{
return
b
?
"true"
:
"false"
;
return
b
?
"true"
:
"false"
;
}
}
/**
/**
* Returns the string representation of the
<code>char</code>
* Returns the string representation of the
{@code char}
* argument.
* argument.
*
*
* @param c a
<code>char</code>
.
* @param c a
{@code char}
.
* @return a string of length
<code>1</code>
containing
* @return a string of length
{@code 1}
containing
* as its single character the argument
<code>c</code>
.
* as its single character the argument
{@code c}
.
*/
*/
public
static
String
valueOf
(
char
c
)
{
public
static
String
valueOf
(
char
c
)
{
char
data
[]
=
{
c
};
char
data
[]
=
{
c
};
...
@@ -2997,13 +2997,13 @@ public final class String
...
@@ -2997,13 +2997,13 @@ public final class String
}
}
/**
/**
* Returns the string representation of the
<code>int</code>
argument.
* Returns the string representation of the
{@code int}
argument.
* <p>
* <p>
* The representation is exactly the one returned by the
* The representation is exactly the one returned by the
*
<code>Integer.toString</code>
method of one argument.
*
{@code Integer.toString}
method of one argument.
*
*
* @param i an
<code>int</code>
.
* @param i an
{@code int}
.
* @return a string representation of the
<code>int</code>
argument.
* @return a string representation of the
{@code int}
argument.
* @see java.lang.Integer#toString(int, int)
* @see java.lang.Integer#toString(int, int)
*/
*/
public
static
String
valueOf
(
int
i
)
{
public
static
String
valueOf
(
int
i
)
{
...
@@ -3011,13 +3011,13 @@ public final class String
...
@@ -3011,13 +3011,13 @@ public final class String
}
}
/**
/**
* Returns the string representation of the
<code>long</code>
argument.
* Returns the string representation of the
{@code long}
argument.
* <p>
* <p>
* The representation is exactly the one returned by the
* The representation is exactly the one returned by the
*
<code>Long.toString</code>
method of one argument.
*
{@code Long.toString}
method of one argument.
*
*
* @param l a
<code>long</code>
.
* @param l a
{@code long}
.
* @return a string representation of the
<code>long</code>
argument.
* @return a string representation of the
{@code long}
argument.
* @see java.lang.Long#toString(long)
* @see java.lang.Long#toString(long)
*/
*/
public
static
String
valueOf
(
long
l
)
{
public
static
String
valueOf
(
long
l
)
{
...
@@ -3025,13 +3025,13 @@ public final class String
...
@@ -3025,13 +3025,13 @@ public final class String
}
}
/**
/**
* Returns the string representation of the
<code>float</code>
argument.
* Returns the string representation of the
{@code float}
argument.
* <p>
* <p>
* The representation is exactly the one returned by the
* The representation is exactly the one returned by the
*
<code>Float.toString</code>
method of one argument.
*
{@code Float.toString}
method of one argument.
*
*
* @param f a
<code>float</code>
.
* @param f a
{@code float}
.
* @return a string representation of the
<code>float</code>
argument.
* @return a string representation of the
{@code float}
argument.
* @see java.lang.Float#toString(float)
* @see java.lang.Float#toString(float)
*/
*/
public
static
String
valueOf
(
float
f
)
{
public
static
String
valueOf
(
float
f
)
{
...
@@ -3039,13 +3039,13 @@ public final class String
...
@@ -3039,13 +3039,13 @@ public final class String
}
}
/**
/**
* Returns the string representation of the
<code>double</code>
argument.
* Returns the string representation of the
{@code double}
argument.
* <p>
* <p>
* The representation is exactly the one returned by the
* The representation is exactly the one returned by the
*
<code>Double.toString</code>
method of one argument.
*
{@code Double.toString}
method of one argument.
*
*
* @param d a
<code>double</code>
.
* @param d a
{@code double}
.
* @return a string representation of the
<code>double</code>
argument.
* @return a string representation of the
{@code double}
argument.
* @see java.lang.Double#toString(double)
* @see java.lang.Double#toString(double)
*/
*/
public
static
String
valueOf
(
double
d
)
{
public
static
String
valueOf
(
double
d
)
{
...
@@ -3056,17 +3056,17 @@ public final class String
...
@@ -3056,17 +3056,17 @@ public final class String
* Returns a canonical representation for the string object.
* Returns a canonical representation for the string object.
* <p>
* <p>
* A pool of strings, initially empty, is maintained privately by the
* A pool of strings, initially empty, is maintained privately by the
* class
<code>String</code>
.
* class
{@code String}
.
* <p>
* <p>
* When the intern method is invoked, if the pool already contains a
* When the intern method is invoked, if the pool already contains a
* string equal to this
<code>String</code>
object as determined by
* string equal to this
{@code String}
object as determined by
* the {@link #equals(Object)} method, then the string from the pool is
* the {@link #equals(Object)} method, then the string from the pool is
* returned. Otherwise, this
<code>String</code>
object is added to the
* returned. Otherwise, this
{@code String}
object is added to the
* pool and a reference to this
<code>String</code>
object is returned.
* pool and a reference to this
{@code String}
object is returned.
* <p>
* <p>
* It follows that for any two strings
<code>s</code> and <code>t</code>
,
* It follows that for any two strings
{@code s} and {@code t}
,
*
<code>s.intern() == t.intern()</code> is <code>true</code>
*
{@code s.intern() == t.intern()} is {@code true}
* if and only if
<code>s.equals(t)</code> is <code>true</code>
.
* if and only if
{@code s.equals(t)} is {@code true}
.
* <p>
* <p>
* All literal strings and string-valued constant expressions are
* All literal strings and string-valued constant expressions are
* interned. String literals are defined in section 3.10.5 of the
* interned. String literals are defined in section 3.10.5 of the
...
...
src/share/classes/java/util/Properties.java
浏览文件 @
c3b10b94
/*
/*
* Copyright (c) 1995, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -37,8 +37,8 @@ import java.io.BufferedWriter;
...
@@ -37,8 +37,8 @@ import java.io.BufferedWriter;
import
java.lang.reflect.*
;
import
java.lang.reflect.*
;
/**
/**
* The
<code>Properties</code>
class represents a persistent set of
* The
{@code Properties}
class represents a persistent set of
* properties. The
<code>Properties</code>
can be saved to a stream
* properties. The
{@code Properties}
can be saved to a stream
* or loaded from a stream. Each key and its corresponding value in
* or loaded from a stream. Each key and its corresponding value in
* the property list is a string.
* the property list is a string.
* <p>
* <p>
...
@@ -46,17 +46,17 @@ import java.lang.reflect.*;
...
@@ -46,17 +46,17 @@ import java.lang.reflect.*;
* "defaults"; this second property list is searched if
* "defaults"; this second property list is searched if
* the property key is not found in the original property list.
* the property key is not found in the original property list.
* <p>
* <p>
* Because
<code>Properties</code> inherits from <code>Hashtable</code>
, the
* Because
{@code Properties} inherits from {@code Hashtable}
, the
*
<code>put</code> and <code>putAll</code>
methods can be applied to a
*
{@code put} and {@code putAll}
methods can be applied to a
*
<code>Properties</code>
object. Their use is strongly discouraged as they
*
{@code Properties}
object. Their use is strongly discouraged as they
* allow the caller to insert entries whose keys or values are not
* allow the caller to insert entries whose keys or values are not
*
<code>Strings</code>. The <code>setProperty</code>
method should be used
*
{@code Strings}. The {@code setProperty}
method should be used
* instead. If the
<code>store</code> or <code>save</code>
method is called
* instead. If the
{@code store} or {@code save}
method is called
* on a "compromised"
<code>Properties</code>
object that contains a
* on a "compromised"
{@code Properties}
object that contains a
* non-
<code>String</code>
key or value, the call will fail. Similarly,
* non-
{@code String}
key or value, the call will fail. Similarly,
* the call to the
<code>propertyNames</code> or <code>list</code>
method
* the call to the
{@code propertyNames} or {@code list}
method
* will fail if it is called on a "compromised"
<code>Properties</code>
* will fail if it is called on a "compromised"
{@code Properties}
* object that contains a non-
<code>String</code>
key.
* object that contains a non-
{@code String}
key.
*
*
* <p>
* <p>
* The {@link #load(java.io.Reader) load(Reader)} <tt>/</tt>
* The {@link #load(java.io.Reader) load(Reader)} <tt>/</tt>
...
@@ -146,15 +146,15 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -146,15 +146,15 @@ class Properties extends Hashtable<Object,Object> {
}
}
/**
/**
* Calls the <tt>Hashtable</tt> method
<code>put</code>
. Provided for
* Calls the <tt>Hashtable</tt> method
{@code put}
. Provided for
* parallelism with the <tt>getProperty</tt> method. Enforces use of
* parallelism with the <tt>getProperty</tt> method. Enforces use of
* strings for property keys and values. The value returned is the
* strings for property keys and values. The value returned is the
* result of the <tt>Hashtable</tt> call to
<code>put</code>
.
* result of the <tt>Hashtable</tt> call to
{@code put}
.
*
*
* @param key the key to be placed into this property list.
* @param key the key to be placed into this property list.
* @param value the value corresponding to <tt>key</tt>.
* @param value the value corresponding to <tt>key</tt>.
* @return the previous value of the specified key in this property
* @return the previous value of the specified key in this property
* list, or
<code>null</code>
if it did not have one.
* list, or
{@code null}
if it did not have one.
* @see #getProperty
* @see #getProperty
* @since 1.2
* @since 1.2
*/
*/
...
@@ -171,13 +171,13 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -171,13 +171,13 @@ class Properties extends Hashtable<Object,Object> {
* kinds of line, <i>natural lines</i> and <i>logical lines</i>.
* kinds of line, <i>natural lines</i> and <i>logical lines</i>.
* A natural line is defined as a line of
* A natural line is defined as a line of
* characters that is terminated either by a set of line terminator
* characters that is terminated either by a set of line terminator
* characters (
<code>\n</code> or <code>\r</code> or <code>\r\n</code>
)
* characters (
{@code \n} or {@code \r} or {@code \r\n}
)
* or by the end of the stream. A natural line may be either a blank line,
* or by the end of the stream. A natural line may be either a blank line,
* a comment line, or hold all or some of a key-element pair. A logical
* a comment line, or hold all or some of a key-element pair. A logical
* line holds all the data of a key-element pair, which may be spread
* line holds all the data of a key-element pair, which may be spread
* out across several adjacent natural lines by escaping
* out across several adjacent natural lines by escaping
* the line terminator sequence with a backslash character
* the line terminator sequence with a backslash character
*
<code>\</code>
. Note that a comment line cannot be extended
*
{@code \}
. Note that a comment line cannot be extended
* in this manner; every natural line that is a comment must have
* in this manner; every natural line that is a comment must have
* its own comment indicator, as described below. Lines are read from
* its own comment indicator, as described below. Lines are read from
* input until the end of the stream is reached.
* input until the end of the stream is reached.
...
@@ -185,13 +185,13 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -185,13 +185,13 @@ class Properties extends Hashtable<Object,Object> {
* <p>
* <p>
* A natural line that contains only white space characters is
* A natural line that contains only white space characters is
* considered blank and is ignored. A comment line has an ASCII
* considered blank and is ignored. A comment line has an ASCII
*
<code>'#'</code> or <code>'!'</code>
as its first non-white
*
{@code '#'} or {@code '!'}
as its first non-white
* space character; comment lines are also ignored and do not
* space character; comment lines are also ignored and do not
* encode key-element information. In addition to line
* encode key-element information. In addition to line
* terminators, this format considers the characters space
* terminators, this format considers the characters space
* (
<code>' '</code>, <code>'\u0020'</code>
), tab
* (
{@code ' '}, {@code '\u005Cu0020'}
), tab
* (
<code>'\t'</code>, <code>'\u0009'</code>
), and form feed
* (
{@code '\t'}, {@code '\u005Cu0009'}
), and form feed
* (
<code>'\f'</code>, <code>'\u000C'</code>
) to be white
* (
{@code '\f'}, {@code '\u005Cu000C'}
) to be white
* space.
* space.
*
*
* <p>
* <p>
...
@@ -215,31 +215,31 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -215,31 +215,31 @@ class Properties extends Hashtable<Object,Object> {
* <p>
* <p>
* The key contains all of the characters in the line starting
* The key contains all of the characters in the line starting
* with the first non-white space character and up to, but not
* with the first non-white space character and up to, but not
* including, the first unescaped
<code>'='</code>
,
* including, the first unescaped
{@code '='}
,
*
<code>':'</code>
, or white space character other than a line
*
{@code ':'}
, or white space character other than a line
* terminator. All of these key termination characters may be
* terminator. All of these key termination characters may be
* included in the key by escaping them with a preceding backslash
* included in the key by escaping them with a preceding backslash
* character; for example,<p>
* character; for example,<p>
*
*
*
<code>\:\=</code>
<p>
*
{@code \:\=}
<p>
*
*
* would be the two-character key
<code>":="</code>
. Line
* would be the two-character key
{@code ":="}
. Line
* terminator characters can be included using
<code>\r</code>
and
* terminator characters can be included using
{@code \r}
and
*
<code>\n</code>
escape sequences. Any white space after the
*
{@code \n}
escape sequences. Any white space after the
* key is skipped; if the first non-white space character after
* key is skipped; if the first non-white space character after
* the key is
<code>'='</code> or <code>':'</code>
, then it is
* the key is
{@code '='} or {@code ':'}
, then it is
* ignored and any white space characters after it are also
* ignored and any white space characters after it are also
* skipped. All remaining characters on the line become part of
* skipped. All remaining characters on the line become part of
* the associated element string; if there are no remaining
* the associated element string; if there are no remaining
* characters, the element is the empty string
* characters, the element is the empty string
*
<code>""</code>
. Once the raw character sequences
*
{@code ""}
. Once the raw character sequences
* constituting the key and element are identified, escape
* constituting the key and element are identified, escape
* processing is performed as described above.
* processing is performed as described above.
*
*
* <p>
* <p>
* As an example, each of the following three lines specifies the key
* As an example, each of the following three lines specifies the key
*
<code>"Truth"</code>
and the associated element value
*
{@code "Truth"}
and the associated element value
*
<code>"Beauty"</code>
:
*
{@code "Beauty"}
:
* <p>
* <p>
* <pre>
* <pre>
* Truth = Beauty
* Truth = Beauty
...
@@ -254,11 +254,11 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -254,11 +254,11 @@ class Properties extends Hashtable<Object,Object> {
* cantaloupe, watermelon, \
* cantaloupe, watermelon, \
* kiwi, mango
* kiwi, mango
* </pre>
* </pre>
* The key is
<code>"fruits"</code>
and the associated element is:
* The key is
{@code "fruits"}
and the associated element is:
* <p>
* <p>
* <pre>"apple, banana, pear, cantaloupe, watermelon, kiwi, mango"</pre>
* <pre>"apple, banana, pear, cantaloupe, watermelon, kiwi, mango"</pre>
* Note that a space appears before each
<code>\</code>
so that a space
* Note that a space appears before each
{@code \}
so that a space
* will appear after each comma in the final result; the
<code>\</code>
,
* will appear after each comma in the final result; the
{@code \}
,
* line terminator, and leading white space on the continuation line are
* line terminator, and leading white space on the continuation line are
* merely discarded and are <i>not</i> replaced by one or more other
* merely discarded and are <i>not</i> replaced by one or more other
* characters.
* characters.
...
@@ -267,8 +267,8 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -267,8 +267,8 @@ class Properties extends Hashtable<Object,Object> {
* <p>
* <p>
* <pre>cheeses
* <pre>cheeses
* </pre>
* </pre>
* specifies that the key is
<code>"cheeses"</code>
and the associated
* specifies that the key is
{@code "cheeses"}
and the associated
* element is the empty string
<code>""</code>
.<p>
* element is the empty string
{@code ""}
.<p>
* <p>
* <p>
*
*
* <a name="unicodeescapes"></a>
* <a name="unicodeescapes"></a>
...
@@ -283,17 +283,17 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -283,17 +283,17 @@ class Properties extends Hashtable<Object,Object> {
* <ul>
* <ul>
* <li> Octal escapes are not recognized.
* <li> Octal escapes are not recognized.
*
*
* <li> The character sequence
<code>\b</code>
does <i>not</i>
* <li> The character sequence
{@code \b}
does <i>not</i>
* represent a backspace character.
* represent a backspace character.
*
*
* <li> The method does not treat a backslash character,
* <li> The method does not treat a backslash character,
*
<code>\</code>
, before a non-valid escape character as an
*
{@code \}
, before a non-valid escape character as an
* error; the backslash is silently dropped. For example, in a
* error; the backslash is silently dropped. For example, in a
* Java string the sequence
<code>"\z"</code>
would cause a
* Java string the sequence
{@code "\z"}
would cause a
* compile time error. In contrast, this method silently drops
* compile time error. In contrast, this method silently drops
* the backslash. Therefore, this method treats the two character
* the backslash. Therefore, this method treats the two character
* sequence
<code>"\b"</code>
as equivalent to the single
* sequence
{@code "\b"}
as equivalent to the single
* character
<code>'b'</code>
.
* character
{@code 'b'}
.
*
*
* <li> Escapes are not necessary for single and double quotes;
* <li> Escapes are not necessary for single and double quotes;
* however, by the rule above, single and double quote characters
* however, by the rule above, single and double quote characters
...
@@ -689,20 +689,20 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -689,20 +689,20 @@ class Properties extends Hashtable<Object,Object> {
}
}
/**
/**
* Calls the
<code>store(OutputStream out, String comments)</code>
method
* Calls the
{@code store(OutputStream out, String comments)}
method
* and suppresses IOExceptions that were thrown.
* and suppresses IOExceptions that were thrown.
*
*
* @deprecated This method does not throw an IOException if an I/O error
* @deprecated This method does not throw an IOException if an I/O error
* occurs while saving the property list. The preferred way to save a
* occurs while saving the property list. The preferred way to save a
* properties list is via the
<code>
store(OutputStream out,
* properties list is via the
{@code
store(OutputStream out,
* String comments)
</code>
method or the
* String comments)
}
method or the
*
<code>storeToXML(OutputStream os, String comment)</code>
method.
*
{@code storeToXML(OutputStream os, String comment)}
method.
*
*
* @param out an output stream.
* @param out an output stream.
* @param comments a description of the property list.
* @param comments a description of the property list.
* @exception ClassCastException if this
<code>Properties</code>
object
* @exception ClassCastException if this
{@code Properties}
object
* contains any keys or values that are not
* contains any keys or values that are not
*
<code>Strings</code>
.
*
{@code Strings}
.
*/
*/
@Deprecated
@Deprecated
public
void
save
(
OutputStream
out
,
String
comments
)
{
public
void
save
(
OutputStream
out
,
String
comments
)
{
...
@@ -714,37 +714,37 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -714,37 +714,37 @@ class Properties extends Hashtable<Object,Object> {
/**
/**
* Writes this property list (key and element pairs) in this
* Writes this property list (key and element pairs) in this
*
<code>Properties</code>
table to the output character stream in a
*
{@code Properties}
table to the output character stream in a
* format suitable for using the {@link #load(java.io.Reader) load(Reader)}
* format suitable for using the {@link #load(java.io.Reader) load(Reader)}
* method.
* method.
* <p>
* <p>
* Properties from the defaults table of this
<code>Properties</code>
* Properties from the defaults table of this
{@code Properties}
* table (if any) are <i>not</i> written out by this method.
* table (if any) are <i>not</i> written out by this method.
* <p>
* <p>
* If the comments argument is not null, then an ASCII
<code>#</code>
* If the comments argument is not null, then an ASCII
{@code #}
* character, the comments string, and a line separator are first written
* character, the comments string, and a line separator are first written
* to the output stream. Thus, the
<code>comments</code>
can serve as an
* to the output stream. Thus, the
{@code comments}
can serve as an
* identifying comment. Any one of a line feed ('\n'), a carriage
* identifying comment. Any one of a line feed ('\n'), a carriage
* return ('\r'), or a carriage return followed immediately by a line feed
* return ('\r'), or a carriage return followed immediately by a line feed
* in comments is replaced by a line separator generated by the
<code>Writer</code>
* in comments is replaced by a line separator generated by the
{@code Writer}
* and if the next character in comments is not character
<code>#</code>
or
* and if the next character in comments is not character
{@code #}
or
* character
<code>!</code> then an ASCII <code>#</code>
is written out
* character
{@code !} then an ASCII {@code #}
is written out
* after that line separator.
* after that line separator.
* <p>
* <p>
* Next, a comment line is always written, consisting of an ASCII
* Next, a comment line is always written, consisting of an ASCII
*
<code>#</code>
character, the current date and time (as if produced
*
{@code #}
character, the current date and time (as if produced
* by the
<code>toString</code> method of <code>Date</code>
for the
* by the
{@code toString} method of {@code Date}
for the
* current time), and a line separator as generated by the
<code>Writer</code>
.
* current time), and a line separator as generated by the
{@code Writer}
.
* <p>
* <p>
* Then every entry in this
<code>Properties</code>
table is
* Then every entry in this
{@code Properties}
table is
* written out, one per line. For each entry the key string is
* written out, one per line. For each entry the key string is
* written, then an ASCII
<code>=</code>
, then the associated
* written, then an ASCII
{@code =}
, then the associated
* element string. For the key, all space characters are
* element string. For the key, all space characters are
* written with a preceding
<code>\</code>
character. For the
* written with a preceding
{@code \}
character. For the
* element, leading space characters, but not embedded or trailing
* element, leading space characters, but not embedded or trailing
* space characters, are written with a preceding
<code>\</code>
* space characters, are written with a preceding
{@code \}
* character. The key and element characters
<code>#</code>
,
* character. The key and element characters
{@code #}
,
*
<code>!</code>, <code>=</code>, and <code>:</code>
are written
*
{@code !}, {@code =}, and {@code :}
are written
* with a preceding backslash to ensure that they are properly loaded.
* with a preceding backslash to ensure that they are properly loaded.
* <p>
* <p>
* After the entries have been written, the output stream is flushed.
* After the entries have been written, the output stream is flushed.
...
@@ -755,9 +755,9 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -755,9 +755,9 @@ class Properties extends Hashtable<Object,Object> {
* @param comments a description of the property list.
* @param comments a description of the property list.
* @exception IOException if writing this property list to the specified
* @exception IOException if writing this property list to the specified
* output stream throws an <tt>IOException</tt>.
* output stream throws an <tt>IOException</tt>.
* @exception ClassCastException if this
<code>Properties</code>
object
* @exception ClassCastException if this
{@code Properties}
object
* contains any keys or values that are not
<code>Strings</code>
.
* contains any keys or values that are not
{@code Strings}
.
* @exception NullPointerException if
<code>writer</code>
is null.
* @exception NullPointerException if
{@code writer}
is null.
* @since 1.6
* @since 1.6
*/
*/
public
void
store
(
Writer
writer
,
String
comments
)
public
void
store
(
Writer
writer
,
String
comments
)
...
@@ -771,11 +771,11 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -771,11 +771,11 @@ class Properties extends Hashtable<Object,Object> {
/**
/**
* Writes this property list (key and element pairs) in this
* Writes this property list (key and element pairs) in this
*
<code>Properties</code>
table to the output stream in a format suitable
*
{@code Properties}
table to the output stream in a format suitable
* for loading into a
<code>Properties</code>
table using the
* for loading into a
{@code Properties}
table using the
* {@link #load(InputStream) load(InputStream)} method.
* {@link #load(InputStream) load(InputStream)} method.
* <p>
* <p>
* Properties from the defaults table of this
<code>Properties</code>
* Properties from the defaults table of this
{@code Properties}
* table (if any) are <i>not</i> written out by this method.
* table (if any) are <i>not</i> written out by this method.
* <p>
* <p>
* This method outputs the comments, properties keys and values in
* This method outputs the comments, properties keys and values in
...
@@ -786,12 +786,12 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -786,12 +786,12 @@ class Properties extends Hashtable<Object,Object> {
* <li>The stream is written using the ISO 8859-1 character encoding.
* <li>The stream is written using the ISO 8859-1 character encoding.
*
*
* <li>Characters not in Latin-1 in the comments are written as
* <li>Characters not in Latin-1 in the comments are written as
*
<code>\u</code>
<i>xxxx</i> for their appropriate unicode
*
{@code \u005Cu}
<i>xxxx</i> for their appropriate unicode
* hexadecimal value <i>xxxx</i>.
* hexadecimal value <i>xxxx</i>.
*
*
* <li>Characters less than
<code>\u0020</code>
and characters greater
* <li>Characters less than
{@code \u005Cu0020}
and characters greater
* than
<code>\u007E</code>
in property keys or values are written
* than
{@code \u005Cu007E}
in property keys or values are written
* as
<code>\u</code>
<i>xxxx</i> for the appropriate hexadecimal
* as
{@code \u005Cu}
<i>xxxx</i> for the appropriate hexadecimal
* value <i>xxxx</i>.
* value <i>xxxx</i>.
* </ul>
* </ul>
* <p>
* <p>
...
@@ -802,9 +802,9 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -802,9 +802,9 @@ class Properties extends Hashtable<Object,Object> {
* @param comments a description of the property list.
* @param comments a description of the property list.
* @exception IOException if writing this property list to the specified
* @exception IOException if writing this property list to the specified
* output stream throws an <tt>IOException</tt>.
* output stream throws an <tt>IOException</tt>.
* @exception ClassCastException if this
<code>Properties</code>
object
* @exception ClassCastException if this
{@code Properties}
object
* contains any keys or values that are not
<code>Strings</code>
.
* contains any keys or values that are not
{@code Strings}
.
* @exception NullPointerException if
<code>out</code>
is null.
* @exception NullPointerException if
{@code out}
is null.
* @since 1.2
* @since 1.2
*/
*/
public
void
store
(
OutputStream
out
,
String
comments
)
public
void
store
(
OutputStream
out
,
String
comments
)
...
@@ -857,7 +857,7 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -857,7 +857,7 @@ class Properties extends Hashtable<Object,Object> {
* results in an <tt>IOException</tt>.
* results in an <tt>IOException</tt>.
* @throws InvalidPropertiesFormatException Data on input stream does not
* @throws InvalidPropertiesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
* constitute a valid XML document with the mandated document type.
* @throws NullPointerException if
<code>in</code>
is null.
* @throws NullPointerException if
{@code in}
is null.
* @see #storeToXML(OutputStream, String, String)
* @see #storeToXML(OutputStream, String, String)
* @since 1.5
* @since 1.5
*/
*/
...
@@ -879,14 +879,14 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -879,14 +879,14 @@ class Properties extends Hashtable<Object,Object> {
* <tt>props.storeToXML(os, comment, "UTF-8");</tt>.
* <tt>props.storeToXML(os, comment, "UTF-8");</tt>.
*
*
* @param os the output stream on which to emit the XML document.
* @param os the output stream on which to emit the XML document.
* @param comment a description of the property list, or
<code>null</code>
* @param comment a description of the property list, or
{@code null}
* if no comment is desired.
* if no comment is desired.
* @throws IOException if writing to the specified output stream
* @throws IOException if writing to the specified output stream
* results in an <tt>IOException</tt>.
* results in an <tt>IOException</tt>.
* @throws NullPointerException if
<code>os</code>
is null.
* @throws NullPointerException if
{@code os}
is null.
* @throws ClassCastException if this
<code>Properties</code>
object
* @throws ClassCastException if this
{@code Properties}
object
* contains any keys or values that are not
* contains any keys or values that are not
*
<code>Strings</code>
.
*
{@code Strings}
.
* @see #loadFromXML(InputStream)
* @see #loadFromXML(InputStream)
* @since 1.5
* @since 1.5
*/
*/
...
@@ -907,13 +907,13 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -907,13 +907,13 @@ class Properties extends Hashtable<Object,Object> {
* <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
* <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
* </pre>
* </pre>
*
*
*<p>If the specified comment is
<code>null</code>
then no comment
*<p>If the specified comment is
{@code null}
then no comment
* will be stored in the document.
* will be stored in the document.
*
*
* <p>The specified stream remains open after this method returns.
* <p>The specified stream remains open after this method returns.
*
*
* @param os the output stream on which to emit the XML document.
* @param os the output stream on which to emit the XML document.
* @param comment a description of the property list, or
<code>null</code>
* @param comment a description of the property list, or
{@code null}
* if no comment is desired.
* if no comment is desired.
* @param encoding the name of a supported
* @param encoding the name of a supported
* <a href="../lang/package-summary.html#charenc">
* <a href="../lang/package-summary.html#charenc">
...
@@ -921,11 +921,11 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -921,11 +921,11 @@ class Properties extends Hashtable<Object,Object> {
*
*
* @throws IOException if writing to the specified output stream
* @throws IOException if writing to the specified output stream
* results in an <tt>IOException</tt>.
* results in an <tt>IOException</tt>.
* @throws NullPointerException if
<code>os</code> is <code>null</code>
,
* @throws NullPointerException if
{@code os} is {@code null}
,
* or if
<code>encoding</code> is <code>null</code>
.
* or if
{@code encoding} is {@code null}
.
* @throws ClassCastException if this
<code>Properties</code>
object
* @throws ClassCastException if this
{@code Properties}
object
* contains any keys or values that are not
* contains any keys or values that are not
*
<code>Strings</code>
.
*
{@code Strings}
.
* @see #loadFromXML(InputStream)
* @see #loadFromXML(InputStream)
* @since 1.5
* @since 1.5
*/
*/
...
@@ -941,7 +941,7 @@ class Properties extends Hashtable<Object,Object> {
...
@@ -941,7 +941,7 @@ class Properties extends Hashtable<Object,Object> {
* Searches for the property with the specified key in this property list.
* Searches for the property with the specified key in this property list.
* If the key is not found in this property list, the default property list,
* If the key is not found in this property list, the default property list,
* and its defaults, recursively, are then checked. The method returns
* and its defaults, recursively, are then checked. The method returns
*
<code>null</code>
if the property is not found.
*
{@code null}
if the property is not found.
*
*
* @param key the property key.
* @param key the property key.
* @return the value in this property list with the specified key value.
* @return the value in this property list with the specified key value.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录