8307409: Refactor usage examples to use @snippet in the java.nio packages

Reviewed-by: alanb, rriggs
This commit is contained in:
Brian Burkhalter 2023-05-12 15:17:22 +00:00
parent e512a20679
commit 9fa8b9a4a6
33 changed files with 433 additions and 386 deletions

View file

@ -840,11 +840,12 @@ public abstract class Charset
* <p> An invocation of this method upon a charset {@code cs} returns the
* same result as the expression
*
* <pre>
* {@snippet lang=java :
* cs.newDecoder()
* .onMalformedInput(CodingErrorAction.REPLACE)
* .onUnmappableCharacter(CodingErrorAction.REPLACE)
* .decode(bb); </pre>
* .decode(bb);
* }
*
* except that it is potentially more efficient because it can cache
* decoders between successive invocations.
@ -876,11 +877,12 @@ public abstract class Charset
* <p> An invocation of this method upon a charset {@code cs} returns the
* same result as the expression
*
* <pre>
* {@snippet lang=java :
* cs.newEncoder()
* .onMalformedInput(CodingErrorAction.REPLACE)
* .onUnmappableCharacter(CodingErrorAction.REPLACE)
* .encode(bb); </pre>
* .encode(bb);
* }
*
* except that it is potentially more efficient because it can cache
* encoders between successive invocations.
@ -911,8 +913,9 @@ public abstract class Charset
* <p> An invocation of this method upon a charset {@code cs} returns the
* same result as the expression
*
* <pre>
* cs.encode(CharBuffer.wrap(s)); </pre>
* {@snippet lang=java :
* cs.encode(CharBuffer.wrap(s));
* }
*
* @param str The string to be encoded
*