Skip to content

Commit 710453c

Browse files
author
Brian Burkhalter
committedMay 23, 2023
8308016: Use snippets in java.io package
Reviewed-by: rriggs
1 parent e9320f3 commit 710453c

20 files changed

+152
-132
lines changed
 

‎src/java.base/share/classes/java/io/BufferedReader.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@
4747
* operations may be costly, such as FileReaders and InputStreamReaders. For
4848
* example,
4949
*
50-
* <pre>
51-
* BufferedReader in
52-
* = new BufferedReader(new FileReader("foo.in"));
53-
* </pre>
50+
* {@snippet lang=java :
51+
* BufferedReader in = new BufferedReader(new FileReader("foo.in"));
52+
* }
5453
*
5554
* will buffer the input from the specified file. Without buffering, each
5655
* invocation of read() or readLine() could cause bytes to be read from the

‎src/java.base/share/classes/java/io/BufferedWriter.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@
4848
* to wrap a BufferedWriter around any Writer whose write() operations may be
4949
* costly, such as FileWriters and OutputStreamWriters. For example,
5050
*
51-
* <pre>
52-
* PrintWriter out
53-
* = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
54-
* </pre>
51+
* {@snippet lang=java :
52+
* PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
53+
* }
5554
*
5655
* will buffer the PrintWriter's output to the file. Without buffering, each
5756
* invocation of a print() method would cause characters to be converted into

‎src/java.base/share/classes/java/io/ByteArrayOutputStream.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -228,19 +228,17 @@ public synchronized String toString() {
228228
*
229229
* <p> An invocation of this method of the form
230230
*
231-
* <pre> {@code
232-
* ByteArrayOutputStream b = ...
233-
* b.toString("UTF-8")
234-
* }
235-
* </pre>
231+
* {@snippet lang=java :
232+
* ByteArrayOutputStream b;
233+
* b.toString("UTF-8")
234+
* }
236235
*
237236
* behaves in exactly the same way as the expression
238237
*
239-
* <pre> {@code
240-
* ByteArrayOutputStream b = ...
241-
* b.toString(StandardCharsets.UTF_8)
242-
* }
243-
* </pre>
238+
* {@snippet lang=java :
239+
* ByteArrayOutputStream b;
240+
* b.toString(StandardCharsets.UTF_8)
241+
* }
244242
*
245243
*
246244
* @param charsetName the name of a supported
@@ -282,9 +280,9 @@ public synchronized String toString(Charset charset) {
282280
* copied into it. Each character <i>c</i> in the resulting string is
283281
* constructed from the corresponding element <i>b</i> in the byte
284282
* array such that:
285-
* <blockquote><pre>{@code
283+
* {@snippet lang=java :
286284
* c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))
287-
* }</pre></blockquote>
285+
* }
288286
*
289287
* @deprecated This method does not properly convert bytes into characters.
290288
* As of JDK&nbsp;1.1, the preferred way to do this is via the

‎src/java.base/share/classes/java/io/CharArrayWriter.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ public void writeTo(Writer out) throws IOException {
152152
* <p> An invocation of this method of the form {@code out.append(csq)}
153153
* behaves in exactly the same way as the invocation
154154
*
155-
* <pre>
156-
* out.write(csq.toString()) </pre>
155+
* {@snippet lang=java :
156+
* out.write(csq.toString())
157+
* }
157158
*
158159
* <p> Depending on the specification of {@code toString} for the
159160
* character sequence {@code csq}, the entire sequence may not be
@@ -184,8 +185,9 @@ public CharArrayWriter append(CharSequence csq) {
184185
* {@code csq} is not {@code null}, behaves in
185186
* exactly the same way as the invocation
186187
*
187-
* <pre>
188-
* out.write(csq.subSequence(start, end).toString()) </pre>
188+
* {@snippet lang=java :
189+
* out.write(csq.subSequence(start, end).toString())
190+
* }
189191
*
190192
* @param csq
191193
* The character sequence from which a subsequence will be
@@ -220,8 +222,9 @@ public CharArrayWriter append(CharSequence csq, int start, int end) {
220222
* <p> An invocation of this method of the form {@code out.append(c)}
221223
* behaves in exactly the same way as the invocation
222224
*
223-
* <pre>
224-
* out.write(c) </pre>
225+
* {@snippet lang=java :
226+
* out.write(c)
227+
* }
225228
*
226229
* @param c
227230
* The 16-bit character to append

‎src/java.base/share/classes/java/io/Console.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
* char[] passwd;
8787
* if ((cons = System.console()) != null &&
8888
* (passwd = cons.readPassword("[%s]", "Password:")) != null) {
89-
* ...
89+
* code: // @replace substring="code:" replacement="..."
9090
* java.util.Arrays.fill(passwd, ' ');
9191
* }
9292
* }
@@ -117,13 +117,13 @@ public PrintWriter writer() {
117117
* This method is intended to be used by sophisticated applications, for
118118
* example, a {@link java.util.Scanner} object which utilizes the rich
119119
* parsing/scanning functionality provided by the {@code Scanner}:
120-
* <blockquote><pre>
121-
* Console con = System.console();
122-
* if (con != null) {
123-
* Scanner sc = new Scanner(con.reader());
124-
* ...
120+
* {@snippet lang=java :
121+
* Console con = System.console();
122+
* if (con != null) {
123+
* Scanner sc = new Scanner(con.reader());
124+
* code: // @replace substring="code:" replacement="..."
125+
* }
125126
* }
126-
* </pre></blockquote>
127127
* <p>
128128
* For simple applications requiring only line-oriented reading, use
129129
* {@link #readLine}.
@@ -186,7 +186,9 @@ public Console format(String fmt, Object ...args) {
186186
* <p> An invocation of this method of the form
187187
* {@code con.printf(format, args)} behaves in exactly the same way
188188
* as the invocation of
189-
* <pre>con.format(format, args)</pre>.
189+
* {@snippet lang=java :
190+
* con.format(format, args)
191+
* }
190192
*
191193
* @param format
192194
* A format string as described in <a

‎src/java.base/share/classes/java/io/File.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -1588,9 +1588,9 @@ public boolean setWritable(boolean writable, boolean ownerOnly) {
15881588
* <p> An invocation of this method of the form {@code file.setWritable(arg)}
15891589
* behaves in exactly the same way as the invocation
15901590
*
1591-
* <pre>{@code
1591+
* {@snippet lang=java :
15921592
* file.setWritable(arg, true)
1593-
* }</pre>
1593+
* }
15941594
*
15951595
* @param writable
15961596
* If {@code true}, sets the access permission to allow write
@@ -1667,9 +1667,9 @@ public boolean setReadable(boolean readable, boolean ownerOnly) {
16671667
* <p>An invocation of this method of the form {@code file.setReadable(arg)}
16681668
* behaves in exactly the same way as the invocation
16691669
*
1670-
* <pre>{@code
1670+
* {@snippet lang=java :
16711671
* file.setReadable(arg, true)
1672-
* }</pre>
1672+
* }
16731673
*
16741674
* @param readable
16751675
* If {@code true}, sets the access permission to allow read
@@ -1749,9 +1749,9 @@ public boolean setExecutable(boolean executable, boolean ownerOnly) {
17491749
* <p>An invocation of this method of the form {@code file.setExcutable(arg)}
17501750
* behaves in exactly the same way as the invocation
17511751
*
1752-
* <pre>{@code
1752+
* {@snippet lang=java :
17531753
* file.setExecutable(arg, true)
1754-
* }</pre>
1754+
* }
17551755
*
17561756
* @param executable
17571757
* If {@code true}, sets the access permission to allow execute
@@ -2370,10 +2370,10 @@ private synchronized void readObject(java.io.ObjectInputStream s)
23702370
*
23712371
* <p> The first invocation of this method works as if invoking it were
23722372
* equivalent to evaluating the expression:
2373-
* <blockquote><pre>
2374-
* {@link java.nio.file.FileSystems#getDefault FileSystems.getDefault}().{@link
2375-
* java.nio.file.FileSystem#getPath getPath}(this.{@link #getPath getPath}());
2376-
* </pre></blockquote>
2373+
* {@snippet lang=java :
2374+
* // @link regex="getPath(?=\(t)" target="java.nio.file.FileSystem#getPath" :
2375+
* FileSystems.getDefault().getPath(this.getPath());
2376+
* }
23772377
* Subsequent invocations of this method return the same {@code Path}.
23782378
*
23792379
* <p> If this abstract pathname is the empty abstract pathname then this

‎src/java.base/share/classes/java/io/FilePermission.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ public String getActions() {
10301030
* <p>and you are calling the {@code implies} method with the FilePermission:
10311031
*
10321032
* <pre>
1033-
* "/tmp/scratch/foo", "read,write",
1033+
* "/tmp/scratch/foo", "read,write",
10341034
* </pre>
10351035
*
10361036
* then the {@code implies} function must

‎src/java.base/share/classes/java/io/InputStream.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ public void close() throws IOException {
201201
*
202202
* @implSpec
203203
* The {@code read(b)} method for class {@code InputStream}
204-
* has the same effect as: <pre>{@code read(b, 0, b.length) }</pre>
204+
* has the same effect as:
205+
* {@snippet lang=java :
206+
* read(b, 0, b.length)
207+
* }
205208
*
206209
* @param b the buffer into which the data is read.
207210
* @return the total number of bytes read into the buffer, or

‎src/java.base/share/classes/java/io/InputStreamReader.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,10 +47,9 @@
4747
* <p> For top efficiency, consider wrapping an InputStreamReader within a
4848
* BufferedReader. For example:
4949
*
50-
* <pre>
51-
* BufferedReader in
52-
* = new BufferedReader(new InputStreamReader(anInputStream));
53-
* </pre>
50+
* {@snippet lang=java :
51+
* BufferedReader in = new BufferedReader(new InputStreamReader(anInputStream));
52+
* }
5453
*
5554
* @see BufferedReader
5655
* @see InputStream

‎src/java.base/share/classes/java/io/OutputStreamWriter.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -46,10 +46,9 @@
4646
* <p> For top efficiency, consider wrapping an OutputStreamWriter within a
4747
* BufferedWriter so as to avoid frequent converter invocations. For example:
4848
*
49-
* <pre>
50-
* Writer out
51-
* = new BufferedWriter(new OutputStreamWriter(anOutputStream));
52-
* </pre>
49+
* {@snippet lang=java :
50+
* Writer out = new BufferedWriter(new OutputStreamWriter(anOutputStream));
51+
* }
5352
*
5453
* <p> A <i>surrogate pair</i> is a character represented by a sequence of two
5554
* {@code char} values: A <i>high</i> surrogate in the range '&#92;uD800' to

‎src/java.base/share/classes/java/io/PipedInputStream.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -175,11 +175,15 @@ private void initPipe(int pipeSize) {
175175
* is an unconnected piped input stream, they
176176
* may be connected by either the call:
177177
*
178-
* <pre>{@code snk.connect(src)} </pre>
178+
* {@snippet lang=java :
179+
* snk.connect(src)
180+
* }
179181
* <p>
180182
* or the call:
181183
*
182-
* <pre>{@code src.connect(snk)} </pre>
184+
* {@snippet lang=java :
185+
* src.connect(snk)
186+
* }
183187
* <p>
184188
* The two calls have the same effect.
185189
*

‎src/java.base/share/classes/java/io/PipedOutputStream.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ public PipedOutputStream() {
8282
* If {@code snk} is an unconnected piped input stream and
8383
* {@code src} is an unconnected piped output stream, they may
8484
* be connected by either the call:
85-
* <blockquote><pre>
86-
* src.connect(snk)</pre></blockquote>
85+
* {@snippet lang=java :
86+
* src.connect(snk)
87+
* }
8788
* or the call:
88-
* <blockquote><pre>
89-
* snk.connect(src)</pre></blockquote>
89+
* {@snippet lang=java :
90+
* snk.connect(src)
91+
* }
9092
* The two calls have the same effect.
9193
*
9294
* @param snk the piped input stream to connect to.

‎src/java.base/share/classes/java/io/PipedReader.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,15 @@ private void initPipe(int pipeSize) {
146146
* is an unconnected piped reader, they
147147
* may be connected by either the call:
148148
*
149-
* <pre>{@code snk.connect(src)} </pre>
149+
* {@snippet lang=java :
150+
* snk.connect(src)
151+
* }
150152
* <p>
151153
* or the call:
152154
*
153-
* <pre>{@code src.connect(snk)} </pre>
155+
* {@snippet lang=java :
156+
* src.connect(snk)
157+
* }
154158
* <p>
155159
* The two calls have the same effect.
156160
*

‎src/java.base/share/classes/java/io/PipedWriter.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ public PipedWriter() {
8080
* If {@code snk} is an unconnected piped reader and
8181
* {@code src} is an unconnected piped writer, they may
8282
* be connected by either the call:
83-
* <blockquote><pre>
84-
* src.connect(snk)</pre></blockquote>
83+
* {@snippet lang=java :
84+
* src.connect(snk)
85+
* }
8586
* or the call:
86-
* <blockquote><pre>
87-
* snk.connect(src)</pre></blockquote>
87+
* {@snippet lang=java :
88+
* snk.connect(src)
89+
* }
8890
* The two calls have the same effect.
8991
*
9092
* @param snk the piped reader to connect to.

‎src/java.base/share/classes/java/io/PrintStream.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1206,9 +1206,9 @@ public void println(Object x) {
12061206
* {@code out.printf(format, args)} behaves
12071207
* in exactly the same way as the invocation
12081208
*
1209-
* <pre>{@code
1209+
* {@snippet lang=java :
12101210
* out.format(format, args)
1211-
* }</pre>
1211+
* }
12121212
*
12131213
* @param format
12141214
* A format string as described in <a
@@ -1253,9 +1253,9 @@ public PrintStream printf(String format, Object ... args) {
12531253
* {@code out.printf(l, format, args)} behaves
12541254
* in exactly the same way as the invocation
12551255
*
1256-
* <pre>{@code
1256+
* {@snippet lang=java :
12571257
* out.format(l, format, args)
1258-
* }</pre>
1258+
* }
12591259
*
12601260
* @param l
12611261
* The {@linkplain java.util.Locale locale} to apply during
@@ -1442,9 +1442,9 @@ private void implFormat(Locale l, String format, Object ... args) throws IOExcep
14421442
* <p> An invocation of this method of the form {@code out.append(csq)}
14431443
* behaves in exactly the same way as the invocation
14441444
*
1445-
* <pre>{@code
1445+
* {@snippet lang=java :
14461446
* out.print(csq.toString())
1447-
* }</pre>
1447+
* }
14481448
*
14491449
* <p> Depending on the specification of {@code toString} for the
14501450
* character sequence {@code csq}, the entire sequence may not be
@@ -1475,9 +1475,9 @@ public PrintStream append(CharSequence csq) {
14751475
* {@code csq} is not {@code null}, behaves in
14761476
* exactly the same way as the invocation
14771477
*
1478-
* <pre>{@code
1478+
* {@snippet lang=java :
14791479
* out.print(csq.subSequence(start, end).toString())
1480-
* }</pre>
1480+
* }
14811481
*
14821482
* @param csq
14831483
* The character sequence from which a subsequence will be
@@ -1512,9 +1512,9 @@ public PrintStream append(CharSequence csq, int start, int end) {
15121512
* <p> An invocation of this method of the form {@code out.append(c)}
15131513
* behaves in exactly the same way as the invocation
15141514
*
1515-
* <pre>{@code
1515+
* {@snippet lang=java :
15161516
* out.print(c)
1517-
* }</pre>
1517+
* }
15181518
*
15191519
* @param c
15201520
* The 16-bit character to append

‎src/java.base/share/classes/java/io/PrintWriter.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -1045,9 +1045,9 @@ public void println(Object x) {
10451045
* {@code out.printf(format, args)}
10461046
* behaves in exactly the same way as the invocation
10471047
*
1048-
* <pre>{@code
1048+
* {@snippet lang=java :
10491049
* out.format(format, args)
1050-
* }</pre>
1050+
* }
10511051
*
10521052
* @param format
10531053
* A format string as described in <a
@@ -1093,9 +1093,9 @@ public PrintWriter printf(String format, Object ... args) {
10931093
* {@code out.printf(l, format, args)}
10941094
* behaves in exactly the same way as the invocation
10951095
*
1096-
* <pre>{@code
1096+
* {@snippet lang=java :
10971097
* out.format(l, format, args)
1098-
* }</pre>
1098+
* }
10991099
*
11001100
* @param l
11011101
* The {@linkplain java.util.Locale locale} to apply during
@@ -1289,9 +1289,9 @@ private void implFormat(Locale l, String format, Object ... args) {
12891289
* <p> An invocation of this method of the form {@code out.append(csq)}
12901290
* behaves in exactly the same way as the invocation
12911291
*
1292-
* <pre>{@code
1292+
* {@snippet lang=java :
12931293
* out.write(csq.toString())
1294-
* }</pre>
1294+
* }
12951295
*
12961296
* <p> Depending on the specification of {@code toString} for the
12971297
* character sequence {@code csq}, the entire sequence may not be
@@ -1321,9 +1321,9 @@ public PrintWriter append(CharSequence csq) {
13211321
* when {@code csq} is not {@code null}, behaves in
13221322
* exactly the same way as the invocation
13231323
*
1324-
* <pre>{@code
1324+
* {@snippet lang=java :
13251325
* out.write(csq.subSequence(start, end).toString())
1326-
* }</pre>
1326+
* }
13271327
*
13281328
* @param csq
13291329
* The character sequence from which a subsequence will be
@@ -1358,9 +1358,9 @@ public PrintWriter append(CharSequence csq, int start, int end) {
13581358
* <p> An invocation of this method of the form {@code out.append(c)}
13591359
* behaves in exactly the same way as the invocation
13601360
*
1361-
* <pre>{@code
1361+
* {@snippet lang=java :
13621362
* out.write(c)
1363-
* }</pre>
1363+
* }
13641364
*
13651365
* @param c
13661366
* The 16-bit character to append

‎src/java.base/share/classes/java/io/RandomAccessFile.java

+23-23
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,9 @@ public final boolean readBoolean() throws IOException {
758758
* If the byte read is {@code b}, where
759759
* {@code 0 <= b <= 255},
760760
* then the result is:
761-
* <blockquote><pre>
761+
* {@snippet lang=java :
762762
* (byte)(b)
763-
* </pre></blockquote>
763+
* }
764764
* <p>
765765
* This method blocks until the byte is read, the end of the stream
766766
* is detected, or an exception is thrown.
@@ -801,9 +801,9 @@ public final int readUnsignedByte() throws IOException {
801801
* {@code b1} and {@code b2}, where each of the two values is
802802
* between {@code 0} and {@code 255}, inclusive, then the
803803
* result is equal to:
804-
* <blockquote><pre>
805-
* (short)((b1 &lt;&lt; 8) | b2)
806-
* </pre></blockquote>
804+
* {@snippet lang=java :
805+
* (short)((b1 << 8) | b2)
806+
* }
807807
* <p>
808808
* This method blocks until the two bytes are read, the end of the
809809
* stream is detected, or an exception is thrown.
@@ -825,9 +825,9 @@ public final short readShort() throws IOException {
825825
* {@code b1} and {@code b2}, where
826826
* {@code 0 <= b1, b2 <= 255},
827827
* then the result is equal to:
828-
* <blockquote><pre>
829-
* (b1 &lt;&lt; 8) | b2
830-
* </pre></blockquote>
828+
* {@snippet lang=java :
829+
* (b1 << 8) | b2
830+
* }
831831
* <p>
832832
* This method blocks until the two bytes are read, the end of the
833833
* stream is detected, or an exception is thrown.
@@ -851,9 +851,9 @@ public final int readUnsignedShort() throws IOException {
851851
* {@code b1} and {@code b2}, where
852852
* {@code 0 <= b1, b2 <= 255},
853853
* then the result is equal to:
854-
* <blockquote><pre>
855-
* (char)((b1 &lt;&lt; 8) | b2)
856-
* </pre></blockquote>
854+
* {@snippet lang=java :
855+
* (char)((b1 << 8) | b2)
856+
* }
857857
* <p>
858858
* This method blocks until the two bytes are read, the end of the
859859
* stream is detected, or an exception is thrown.
@@ -875,9 +875,9 @@ public final char readChar() throws IOException {
875875
* {@code b2}, {@code b3}, and {@code b4}, where
876876
* {@code 0 <= b1, b2, b3, b4 <= 255},
877877
* then the result is equal to:
878-
* <blockquote><pre>
879-
* (b1 &lt;&lt; 24) | (b2 &lt;&lt; 16) + (b3 &lt;&lt; 8) + b4
880-
* </pre></blockquote>
878+
* {@snippet lang=java :
879+
* (b1 << 24) | (b2 << 16) + (b3 << 8) + b4
880+
* }
881881
* <p>
882882
* This method blocks until the four bytes are read, the end of the
883883
* stream is detected, or an exception is thrown.
@@ -900,17 +900,17 @@ public final int readInt() throws IOException {
900900
* {@code b1}, {@code b2}, {@code b3},
901901
* {@code b4}, {@code b5}, {@code b6},
902902
* {@code b7}, and {@code b8,} where:
903-
* <blockquote><pre>
904-
* 0 &lt;= b1, b2, b3, b4, b5, b6, b7, b8 &lt;=255,
905-
* </pre></blockquote>
903+
* {@snippet :
904+
* 0 <= b1, b2, b3, b4, b5, b6, b7, b8 <= 255
905+
* }
906906
* <p>
907907
* then the result is equal to:
908-
* <blockquote><pre>
909-
* ((long)b1 &lt;&lt; 56) + ((long)b2 &lt;&lt; 48)
910-
* + ((long)b3 &lt;&lt; 40) + ((long)b4 &lt;&lt; 32)
911-
* + ((long)b5 &lt;&lt; 24) + ((long)b6 &lt;&lt; 16)
912-
* + ((long)b7 &lt;&lt; 8) + b8
913-
* </pre></blockquote>
908+
* {@snippet lang=java :
909+
* ((long)b1 << 56) + ((long)b2 << 48)
910+
* + ((long)b3 << 40) + ((long)b4 << 32)
911+
* + ((long)b5 << 24) + ((long)b6 << 16)
912+
* + ((long)b7 << 8) + b8
913+
* }
914914
* <p>
915915
* This method blocks until the eight bytes are read, the end of the
916916
* stream is detected, or an exception is thrown.

‎src/java.base/share/classes/java/io/StreamTokenizer.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ private StreamTokenizer() {
217217
*
218218
* @deprecated As of JDK version 1.1, the preferred way to tokenize an
219219
* input stream is to convert it into a character stream, for example:
220-
* <blockquote><pre>
221-
* Reader r = new BufferedReader(new InputStreamReader(is));
222-
* StreamTokenizer st = new StreamTokenizer(r);
223-
* </pre></blockquote>
220+
* {@snippet lang=java :
221+
* Reader r = new BufferedReader(new InputStreamReader(is));
222+
* StreamTokenizer st = new StreamTokenizer(r);
223+
* }
224224
*
225225
* @param is an input stream.
226226
* @see java.io.BufferedReader
@@ -391,7 +391,7 @@ public void quoteChar(int ch) {
391391
* syntax table of this tokenizer is modified so that each of the twelve
392392
* characters:
393393
* <blockquote><pre>
394-
* 0 1 2 3 4 5 6 7 8 9 . -
394+
* 0 1 2 3 4 5 6 7 8 9 . -
395395
* </pre></blockquote>
396396
* <p>
397397
* has the "numeric" attribute.
@@ -770,7 +770,9 @@ public int lineno() {
770770
* <p>The precise string returned is unspecified, although the following
771771
* example can be considered typical:
772772
*
773-
* <blockquote><pre>Token['a'], line 10</pre></blockquote>
773+
* <blockquote><pre>
774+
* Token['a'], line 10
775+
* </pre></blockquote>
774776
*
775777
* @return a string representation of the token
776778
* @see java.io.StreamTokenizer#nval

‎src/java.base/share/classes/java/io/StringWriter.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ public void write(String str, int off, int len) {
128128
* <p> An invocation of this method of the form {@code out.append(csq)}
129129
* behaves in exactly the same way as the invocation
130130
*
131-
* <pre>
132-
* out.write(csq.toString()) </pre>
131+
* {@snippet lang=java :
132+
* out.write(csq.toString())
133+
* }
133134
*
134135
* <p> Depending on the specification of {@code toString} for the
135136
* character sequence {@code csq}, the entire sequence may not be
@@ -159,9 +160,9 @@ public StringWriter append(CharSequence csq) {
159160
* is not {@code null}, behaves in
160161
* exactly the same way as the invocation
161162
*
162-
* <pre>{@code
163+
* {@snippet lang=java :
163164
* out.write(csq.subSequence(start, end).toString())
164-
* }</pre>
165+
* }
165166
*
166167
* @param csq
167168
* The character sequence from which a subsequence will be
@@ -196,8 +197,9 @@ public StringWriter append(CharSequence csq, int start, int end) {
196197
* <p> An invocation of this method of the form {@code out.append(c)}
197198
* behaves in exactly the same way as the invocation
198199
*
199-
* <pre>
200-
* out.write(c) </pre>
200+
* {@snippet lang=java :
201+
* out.write(c)
202+
* }
201203
*
202204
* @param c
203205
* The 16-bit character to append

‎src/java.base/share/classes/java/io/Writer.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -340,8 +340,9 @@ private void implWrite(String str, int off, int len) throws IOException {
340340
* <p> An invocation of this method of the form {@code out.append(csq)}
341341
* behaves in exactly the same way as the invocation
342342
*
343-
* <pre>
344-
* out.write(csq.toString()) </pre>
343+
* {@snippet lang=java :
344+
* out.write(csq.toString())
345+
* }
345346
*
346347
* <p> Depending on the specification of {@code toString} for the
347348
* character sequence {@code csq}, the entire sequence may not be
@@ -375,9 +376,9 @@ public Writer append(CharSequence csq) throws IOException {
375376
* is not {@code null} behaves in exactly the
376377
* same way as the invocation
377378
*
378-
* <pre>{@code
379+
* {@snippet lang=java :
379380
* out.write(csq.subSequence(start, end).toString())
380-
* }</pre>
381+
* }
381382
*
382383
* @param csq
383384
* The character sequence from which a subsequence will be
@@ -415,8 +416,9 @@ public Writer append(CharSequence csq, int start, int end) throws IOException {
415416
* <p> An invocation of this method of the form {@code out.append(c)}
416417
* behaves in exactly the same way as the invocation
417418
*
418-
* <pre>
419-
* out.write(c) </pre>
419+
* {@snippet lang=java :
420+
* out.write(c)
421+
* }
420422
*
421423
* @param c
422424
* The 16-bit character to append

0 commit comments

Comments
 (0)
Please sign in to comment.