mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8308016: Use snippets in java.io package
Reviewed-by: rriggs
This commit is contained in:
parent
e9320f31dc
commit
710453c676
20 changed files with 152 additions and 132 deletions
|
@ -47,10 +47,9 @@ import jdk.internal.misc.InternalLock;
|
|||
* operations may be costly, such as FileReaders and InputStreamReaders. For
|
||||
* example,
|
||||
*
|
||||
* <pre>
|
||||
* BufferedReader in
|
||||
* = new BufferedReader(new FileReader("foo.in"));
|
||||
* </pre>
|
||||
* {@snippet lang=java :
|
||||
* BufferedReader in = new BufferedReader(new FileReader("foo.in"));
|
||||
* }
|
||||
*
|
||||
* will buffer the input from the specified file. Without buffering, each
|
||||
* invocation of read() or readLine() could cause bytes to be read from the
|
||||
|
|
|
@ -48,10 +48,9 @@ import jdk.internal.misc.VM;
|
|||
* to wrap a BufferedWriter around any Writer whose write() operations may be
|
||||
* costly, such as FileWriters and OutputStreamWriters. For example,
|
||||
*
|
||||
* <pre>
|
||||
* PrintWriter out
|
||||
* = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
|
||||
* </pre>
|
||||
* {@snippet lang=java :
|
||||
* PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
|
||||
* }
|
||||
*
|
||||
* will buffer the PrintWriter's output to the file. Without buffering, each
|
||||
* invocation of a print() method would cause characters to be converted into
|
||||
|
|
|
@ -228,19 +228,17 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
*
|
||||
* <p> An invocation of this method of the form
|
||||
*
|
||||
* <pre> {@code
|
||||
* ByteArrayOutputStream b = ...
|
||||
* b.toString("UTF-8")
|
||||
* }
|
||||
* </pre>
|
||||
* {@snippet lang=java :
|
||||
* ByteArrayOutputStream b;
|
||||
* b.toString("UTF-8")
|
||||
* }
|
||||
*
|
||||
* behaves in exactly the same way as the expression
|
||||
*
|
||||
* <pre> {@code
|
||||
* ByteArrayOutputStream b = ...
|
||||
* b.toString(StandardCharsets.UTF_8)
|
||||
* }
|
||||
* </pre>
|
||||
* {@snippet lang=java :
|
||||
* ByteArrayOutputStream b;
|
||||
* b.toString(StandardCharsets.UTF_8)
|
||||
* }
|
||||
*
|
||||
*
|
||||
* @param charsetName the name of a supported
|
||||
|
@ -282,9 +280,9 @@ public class ByteArrayOutputStream extends OutputStream {
|
|||
* copied into it. Each character <i>c</i> in the resulting string is
|
||||
* constructed from the corresponding element <i>b</i> in the byte
|
||||
* array such that:
|
||||
* <blockquote><pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))
|
||||
* }</pre></blockquote>
|
||||
* }
|
||||
*
|
||||
* @deprecated This method does not properly convert bytes into characters.
|
||||
* As of JDK 1.1, the preferred way to do this is via the
|
||||
|
|
|
@ -152,8 +152,9 @@ public class CharArrayWriter extends Writer {
|
|||
* <p> An invocation of this method of the form {@code out.append(csq)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* out.write(csq.toString()) </pre>
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.toString())
|
||||
* }
|
||||
*
|
||||
* <p> Depending on the specification of {@code toString} for the
|
||||
* character sequence {@code csq}, the entire sequence may not be
|
||||
|
@ -184,8 +185,9 @@ public class CharArrayWriter extends Writer {
|
|||
* {@code csq} is not {@code null}, behaves in
|
||||
* exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* out.write(csq.subSequence(start, end).toString()) </pre>
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.subSequence(start, end).toString())
|
||||
* }
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence from which a subsequence will be
|
||||
|
@ -220,8 +222,9 @@ public class CharArrayWriter extends Writer {
|
|||
* <p> An invocation of this method of the form {@code out.append(c)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* out.write(c) </pre>
|
||||
* {@snippet lang=java :
|
||||
* out.write(c)
|
||||
* }
|
||||
*
|
||||
* @param c
|
||||
* The 16-bit character to append
|
||||
|
|
|
@ -86,7 +86,7 @@ import sun.security.action.GetPropertyAction;
|
|||
* char[] passwd;
|
||||
* if ((cons = System.console()) != null &&
|
||||
* (passwd = cons.readPassword("[%s]", "Password:")) != null) {
|
||||
* ...
|
||||
* code: // @replace substring="code:" replacement="..."
|
||||
* java.util.Arrays.fill(passwd, ' ');
|
||||
* }
|
||||
* }
|
||||
|
@ -117,13 +117,13 @@ public sealed class Console implements Flushable permits ProxyingConsole {
|
|||
* This method is intended to be used by sophisticated applications, for
|
||||
* example, a {@link java.util.Scanner} object which utilizes the rich
|
||||
* parsing/scanning functionality provided by the {@code Scanner}:
|
||||
* <blockquote><pre>
|
||||
* Console con = System.console();
|
||||
* if (con != null) {
|
||||
* Scanner sc = new Scanner(con.reader());
|
||||
* ...
|
||||
* {@snippet lang=java :
|
||||
* Console con = System.console();
|
||||
* if (con != null) {
|
||||
* Scanner sc = new Scanner(con.reader());
|
||||
* code: // @replace substring="code:" replacement="..."
|
||||
* }
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
* <p>
|
||||
* For simple applications requiring only line-oriented reading, use
|
||||
* {@link #readLine}.
|
||||
|
@ -186,7 +186,9 @@ public sealed class Console implements Flushable permits ProxyingConsole {
|
|||
* <p> An invocation of this method of the form
|
||||
* {@code con.printf(format, args)} behaves in exactly the same way
|
||||
* as the invocation of
|
||||
* <pre>con.format(format, args)</pre>.
|
||||
* {@snippet lang=java :
|
||||
* con.format(format, args)
|
||||
* }
|
||||
*
|
||||
* @param format
|
||||
* A format string as described in <a
|
||||
|
|
|
@ -1588,9 +1588,9 @@ public class File
|
|||
* <p> An invocation of this method of the form {@code file.setWritable(arg)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* file.setWritable(arg, true)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param writable
|
||||
* If {@code true}, sets the access permission to allow write
|
||||
|
@ -1667,9 +1667,9 @@ public class File
|
|||
* <p>An invocation of this method of the form {@code file.setReadable(arg)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* file.setReadable(arg, true)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param readable
|
||||
* If {@code true}, sets the access permission to allow read
|
||||
|
@ -1749,9 +1749,9 @@ public class File
|
|||
* <p>An invocation of this method of the form {@code file.setExcutable(arg)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* file.setExecutable(arg, true)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param executable
|
||||
* If {@code true}, sets the access permission to allow execute
|
||||
|
@ -2370,10 +2370,10 @@ public class File
|
|||
*
|
||||
* <p> The first invocation of this method works as if invoking it were
|
||||
* equivalent to evaluating the expression:
|
||||
* <blockquote><pre>
|
||||
* {@link java.nio.file.FileSystems#getDefault FileSystems.getDefault}().{@link
|
||||
* java.nio.file.FileSystem#getPath getPath}(this.{@link #getPath getPath}());
|
||||
* </pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* // @link regex="getPath(?=\(t)" target="java.nio.file.FileSystem#getPath" :
|
||||
* FileSystems.getDefault().getPath(this.getPath());
|
||||
* }
|
||||
* Subsequent invocations of this method return the same {@code Path}.
|
||||
*
|
||||
* <p> If this abstract pathname is the empty abstract pathname then this
|
||||
|
|
|
@ -1030,7 +1030,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||
* <p>and you are calling the {@code implies} method with the FilePermission:
|
||||
*
|
||||
* <pre>
|
||||
* "/tmp/scratch/foo", "read,write",
|
||||
* "/tmp/scratch/foo", "read,write",
|
||||
* </pre>
|
||||
*
|
||||
* then the {@code implies} function must
|
||||
|
|
|
@ -201,7 +201,10 @@ public abstract class InputStream implements Closeable {
|
|||
*
|
||||
* @implSpec
|
||||
* The {@code read(b)} method for class {@code InputStream}
|
||||
* has the same effect as: <pre>{@code read(b, 0, b.length) }</pre>
|
||||
* has the same effect as:
|
||||
* {@snippet lang=java :
|
||||
* read(b, 0, b.length)
|
||||
* }
|
||||
*
|
||||
* @param b the buffer into which the data is read.
|
||||
* @return the total number of bytes read into the buffer, or
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -47,10 +47,9 @@ import sun.nio.cs.StreamDecoder;
|
|||
* <p> For top efficiency, consider wrapping an InputStreamReader within a
|
||||
* BufferedReader. For example:
|
||||
*
|
||||
* <pre>
|
||||
* BufferedReader in
|
||||
* = new BufferedReader(new InputStreamReader(anInputStream));
|
||||
* </pre>
|
||||
* {@snippet lang=java :
|
||||
* BufferedReader in = new BufferedReader(new InputStreamReader(anInputStream));
|
||||
* }
|
||||
*
|
||||
* @see BufferedReader
|
||||
* @see InputStream
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -46,10 +46,9 @@ import sun.nio.cs.StreamEncoder;
|
|||
* <p> For top efficiency, consider wrapping an OutputStreamWriter within a
|
||||
* BufferedWriter so as to avoid frequent converter invocations. For example:
|
||||
*
|
||||
* <pre>
|
||||
* Writer out
|
||||
* = new BufferedWriter(new OutputStreamWriter(anOutputStream));
|
||||
* </pre>
|
||||
* {@snippet lang=java :
|
||||
* Writer out = new BufferedWriter(new OutputStreamWriter(anOutputStream));
|
||||
* }
|
||||
*
|
||||
* <p> A <i>surrogate pair</i> is a character represented by a sequence of two
|
||||
* {@code char} values: A <i>high</i> surrogate in the range '\uD800' to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -175,11 +175,15 @@ public class PipedInputStream extends InputStream {
|
|||
* is an unconnected piped input stream, they
|
||||
* may be connected by either the call:
|
||||
*
|
||||
* <pre>{@code snk.connect(src)} </pre>
|
||||
* {@snippet lang=java :
|
||||
* snk.connect(src)
|
||||
* }
|
||||
* <p>
|
||||
* or the call:
|
||||
*
|
||||
* <pre>{@code src.connect(snk)} </pre>
|
||||
* {@snippet lang=java :
|
||||
* src.connect(snk)
|
||||
* }
|
||||
* <p>
|
||||
* The two calls have the same effect.
|
||||
*
|
||||
|
|
|
@ -82,11 +82,13 @@ public class PipedOutputStream extends OutputStream {
|
|||
* If {@code snk} is an unconnected piped input stream and
|
||||
* {@code src} is an unconnected piped output stream, they may
|
||||
* be connected by either the call:
|
||||
* <blockquote><pre>
|
||||
* src.connect(snk)</pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* src.connect(snk)
|
||||
* }
|
||||
* or the call:
|
||||
* <blockquote><pre>
|
||||
* snk.connect(src)</pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* snk.connect(src)
|
||||
* }
|
||||
* The two calls have the same effect.
|
||||
*
|
||||
* @param snk the piped input stream to connect to.
|
||||
|
|
|
@ -146,11 +146,15 @@ public class PipedReader extends Reader {
|
|||
* is an unconnected piped reader, they
|
||||
* may be connected by either the call:
|
||||
*
|
||||
* <pre>{@code snk.connect(src)} </pre>
|
||||
* {@snippet lang=java :
|
||||
* snk.connect(src)
|
||||
* }
|
||||
* <p>
|
||||
* or the call:
|
||||
*
|
||||
* <pre>{@code src.connect(snk)} </pre>
|
||||
* {@snippet lang=java :
|
||||
* src.connect(snk)
|
||||
* }
|
||||
* <p>
|
||||
* The two calls have the same effect.
|
||||
*
|
||||
|
|
|
@ -80,11 +80,13 @@ public class PipedWriter extends Writer {
|
|||
* If {@code snk} is an unconnected piped reader and
|
||||
* {@code src} is an unconnected piped writer, they may
|
||||
* be connected by either the call:
|
||||
* <blockquote><pre>
|
||||
* src.connect(snk)</pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* src.connect(snk)
|
||||
* }
|
||||
* or the call:
|
||||
* <blockquote><pre>
|
||||
* snk.connect(src)</pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* snk.connect(src)
|
||||
* }
|
||||
* The two calls have the same effect.
|
||||
*
|
||||
* @param snk the piped reader to connect to.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1206,9 +1206,9 @@ public class PrintStream extends FilterOutputStream
|
|||
* {@code out.printf(format, args)} behaves
|
||||
* in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.format(format, args)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param format
|
||||
* A format string as described in <a
|
||||
|
@ -1253,9 +1253,9 @@ public class PrintStream extends FilterOutputStream
|
|||
* {@code out.printf(l, format, args)} behaves
|
||||
* in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.format(l, format, args)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param l
|
||||
* The {@linkplain java.util.Locale locale} to apply during
|
||||
|
@ -1442,9 +1442,9 @@ public class PrintStream extends FilterOutputStream
|
|||
* <p> An invocation of this method of the form {@code out.append(csq)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.print(csq.toString())
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* <p> Depending on the specification of {@code toString} for the
|
||||
* character sequence {@code csq}, the entire sequence may not be
|
||||
|
@ -1475,9 +1475,9 @@ public class PrintStream extends FilterOutputStream
|
|||
* {@code csq} is not {@code null}, behaves in
|
||||
* exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.print(csq.subSequence(start, end).toString())
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence from which a subsequence will be
|
||||
|
@ -1512,9 +1512,9 @@ public class PrintStream extends FilterOutputStream
|
|||
* <p> An invocation of this method of the form {@code out.append(c)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.print(c)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param c
|
||||
* The 16-bit character to append
|
||||
|
|
|
@ -1045,9 +1045,9 @@ public class PrintWriter extends Writer {
|
|||
* {@code out.printf(format, args)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.format(format, args)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param format
|
||||
* A format string as described in <a
|
||||
|
@ -1093,9 +1093,9 @@ public class PrintWriter extends Writer {
|
|||
* {@code out.printf(l, format, args)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.format(l, format, args)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param l
|
||||
* The {@linkplain java.util.Locale locale} to apply during
|
||||
|
@ -1289,9 +1289,9 @@ public class PrintWriter extends Writer {
|
|||
* <p> An invocation of this method of the form {@code out.append(csq)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.toString())
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* <p> Depending on the specification of {@code toString} for the
|
||||
* character sequence {@code csq}, the entire sequence may not be
|
||||
|
@ -1321,9 +1321,9 @@ public class PrintWriter extends Writer {
|
|||
* when {@code csq} is not {@code null}, behaves in
|
||||
* exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.subSequence(start, end).toString())
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence from which a subsequence will be
|
||||
|
@ -1358,9 +1358,9 @@ public class PrintWriter extends Writer {
|
|||
* <p> An invocation of this method of the form {@code out.append(c)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.write(c)
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param c
|
||||
* The 16-bit character to append
|
||||
|
|
|
@ -758,9 +758,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
|||
* If the byte read is {@code b}, where
|
||||
* {@code 0 <= b <= 255},
|
||||
* then the result is:
|
||||
* <blockquote><pre>
|
||||
* {@snippet lang=java :
|
||||
* (byte)(b)
|
||||
* </pre></blockquote>
|
||||
* }
|
||||
* <p>
|
||||
* This method blocks until the byte is read, the end of the stream
|
||||
* is detected, or an exception is thrown.
|
||||
|
@ -801,9 +801,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
|||
* {@code b1} and {@code b2}, where each of the two values is
|
||||
* between {@code 0} and {@code 255}, inclusive, then the
|
||||
* result is equal to:
|
||||
* <blockquote><pre>
|
||||
* (short)((b1 << 8) | b2)
|
||||
* </pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* (short)((b1 << 8) | b2)
|
||||
* }
|
||||
* <p>
|
||||
* This method blocks until the two bytes are read, the end of the
|
||||
* stream is detected, or an exception is thrown.
|
||||
|
@ -825,9 +825,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
|||
* {@code b1} and {@code b2}, where
|
||||
* {@code 0 <= b1, b2 <= 255},
|
||||
* then the result is equal to:
|
||||
* <blockquote><pre>
|
||||
* (b1 << 8) | b2
|
||||
* </pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* (b1 << 8) | b2
|
||||
* }
|
||||
* <p>
|
||||
* This method blocks until the two bytes are read, the end of the
|
||||
* stream is detected, or an exception is thrown.
|
||||
|
@ -851,9 +851,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
|||
* {@code b1} and {@code b2}, where
|
||||
* {@code 0 <= b1, b2 <= 255},
|
||||
* then the result is equal to:
|
||||
* <blockquote><pre>
|
||||
* (char)((b1 << 8) | b2)
|
||||
* </pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* (char)((b1 << 8) | b2)
|
||||
* }
|
||||
* <p>
|
||||
* This method blocks until the two bytes are read, the end of the
|
||||
* stream is detected, or an exception is thrown.
|
||||
|
@ -875,9 +875,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
|||
* {@code b2}, {@code b3}, and {@code b4}, where
|
||||
* {@code 0 <= b1, b2, b3, b4 <= 255},
|
||||
* then the result is equal to:
|
||||
* <blockquote><pre>
|
||||
* (b1 << 24) | (b2 << 16) + (b3 << 8) + b4
|
||||
* </pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* (b1 << 24) | (b2 << 16) + (b3 << 8) + b4
|
||||
* }
|
||||
* <p>
|
||||
* This method blocks until the four bytes are read, the end of the
|
||||
* stream is detected, or an exception is thrown.
|
||||
|
@ -900,17 +900,17 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
|||
* {@code b1}, {@code b2}, {@code b3},
|
||||
* {@code b4}, {@code b5}, {@code b6},
|
||||
* {@code b7}, and {@code b8,} where:
|
||||
* <blockquote><pre>
|
||||
* 0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
|
||||
* </pre></blockquote>
|
||||
* {@snippet :
|
||||
* 0 <= b1, b2, b3, b4, b5, b6, b7, b8 <= 255
|
||||
* }
|
||||
* <p>
|
||||
* then the result is equal to:
|
||||
* <blockquote><pre>
|
||||
* ((long)b1 << 56) + ((long)b2 << 48)
|
||||
* + ((long)b3 << 40) + ((long)b4 << 32)
|
||||
* + ((long)b5 << 24) + ((long)b6 << 16)
|
||||
* + ((long)b7 << 8) + b8
|
||||
* </pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* ((long)b1 << 56) + ((long)b2 << 48)
|
||||
* + ((long)b3 << 40) + ((long)b4 << 32)
|
||||
* + ((long)b5 << 24) + ((long)b6 << 16)
|
||||
* + ((long)b7 << 8) + b8
|
||||
* }
|
||||
* <p>
|
||||
* This method blocks until the eight bytes are read, the end of the
|
||||
* stream is detected, or an exception is thrown.
|
||||
|
|
|
@ -217,10 +217,10 @@ public class StreamTokenizer {
|
|||
*
|
||||
* @deprecated As of JDK version 1.1, the preferred way to tokenize an
|
||||
* input stream is to convert it into a character stream, for example:
|
||||
* <blockquote><pre>
|
||||
* Reader r = new BufferedReader(new InputStreamReader(is));
|
||||
* StreamTokenizer st = new StreamTokenizer(r);
|
||||
* </pre></blockquote>
|
||||
* {@snippet lang=java :
|
||||
* Reader r = new BufferedReader(new InputStreamReader(is));
|
||||
* StreamTokenizer st = new StreamTokenizer(r);
|
||||
* }
|
||||
*
|
||||
* @param is an input stream.
|
||||
* @see java.io.BufferedReader
|
||||
|
@ -391,7 +391,7 @@ public class StreamTokenizer {
|
|||
* syntax table of this tokenizer is modified so that each of the twelve
|
||||
* characters:
|
||||
* <blockquote><pre>
|
||||
* 0 1 2 3 4 5 6 7 8 9 . -
|
||||
* 0 1 2 3 4 5 6 7 8 9 . -
|
||||
* </pre></blockquote>
|
||||
* <p>
|
||||
* has the "numeric" attribute.
|
||||
|
@ -770,7 +770,9 @@ public class StreamTokenizer {
|
|||
* <p>The precise string returned is unspecified, although the following
|
||||
* example can be considered typical:
|
||||
*
|
||||
* <blockquote><pre>Token['a'], line 10</pre></blockquote>
|
||||
* <blockquote><pre>
|
||||
* Token['a'], line 10
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* @return a string representation of the token
|
||||
* @see java.io.StreamTokenizer#nval
|
||||
|
|
|
@ -128,8 +128,9 @@ public class StringWriter extends Writer {
|
|||
* <p> An invocation of this method of the form {@code out.append(csq)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* out.write(csq.toString()) </pre>
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.toString())
|
||||
* }
|
||||
*
|
||||
* <p> Depending on the specification of {@code toString} for the
|
||||
* character sequence {@code csq}, the entire sequence may not be
|
||||
|
@ -159,9 +160,9 @@ public class StringWriter extends Writer {
|
|||
* is not {@code null}, behaves in
|
||||
* exactly the same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.subSequence(start, end).toString())
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence from which a subsequence will be
|
||||
|
@ -196,8 +197,9 @@ public class StringWriter extends Writer {
|
|||
* <p> An invocation of this method of the form {@code out.append(c)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* out.write(c) </pre>
|
||||
* {@snippet lang=java :
|
||||
* out.write(c)
|
||||
* }
|
||||
*
|
||||
* @param c
|
||||
* The 16-bit character to append
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -340,8 +340,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
|
|||
* <p> An invocation of this method of the form {@code out.append(csq)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* out.write(csq.toString()) </pre>
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.toString())
|
||||
* }
|
||||
*
|
||||
* <p> Depending on the specification of {@code toString} for the
|
||||
* character sequence {@code csq}, the entire sequence may not be
|
||||
|
@ -375,9 +376,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
|
|||
* is not {@code null} behaves in exactly the
|
||||
* same way as the invocation
|
||||
*
|
||||
* <pre>{@code
|
||||
* {@snippet lang=java :
|
||||
* out.write(csq.subSequence(start, end).toString())
|
||||
* }</pre>
|
||||
* }
|
||||
*
|
||||
* @param csq
|
||||
* The character sequence from which a subsequence will be
|
||||
|
@ -415,8 +416,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
|
|||
* <p> An invocation of this method of the form {@code out.append(c)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
*
|
||||
* <pre>
|
||||
* out.write(c) </pre>
|
||||
* {@snippet lang=java :
|
||||
* out.write(c)
|
||||
* }
|
||||
*
|
||||
* @param c
|
||||
* The 16-bit character to append
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue