Skip to content

Commit

Permalink
8318677: (ch) Add implNote about minBufferCap to main variant of Chan…
Browse files Browse the repository at this point in the history
…nels.newWriter

Reviewed-by: alanb, rriggs
  • Loading branch information
Brian Burkhalter committed Oct 30, 2023
1 parent 864a876 commit d3534b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/java.base/share/classes/java/nio/channels/Channels.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ public static Reader newReader(ReadableByteChannel ch, Charset charset) {
* The resulting stream will not otherwise be buffered. Closing the stream
* will in turn cause the channel to be closed. </p>
*
* @implNote
* The value of {@code minBufferCap} is ignored.
*
* @param ch
* The channel to which bytes will be written
*
Expand All @@ -532,7 +535,8 @@ public static Reader newReader(ReadableByteChannel ch, Charset charset) {
* @param minBufferCap
* The minimum capacity of the internal byte buffer,
* or {@code -1} if an implementation-dependent
* default capacity is to be used
* default capacity is to be used. The value of
* {@code minBufferCap} may be ignored
*
* @return A new writer
*/
Expand Down
3 changes: 1 addition & 2 deletions test/jdk/java/nio/channels/Channels/NewWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class NewWriter {
private int actual = 0;

@Test
public void oneByteChannel() throws IOException {
public void customWritableByteChannel() throws IOException {
try (Writer writer = Channels.newWriter(new WritableByteChannel() {
@Override
public int write(ByteBuffer src) {
Expand Down Expand Up @@ -89,7 +89,6 @@ public void socketChannel() throws IOException {
ss.bind(new InetSocketAddress(lb, 0));
sc.connect(ss.getLocalSocketAddress());
sc.configureBlocking(false);
sc.setOption(StandardSocketOptions.SO_SNDBUF, 8192);
try (Writer writer = Channels.newWriter(sc,
StandardCharsets.UTF_8)) {
for (int i = 1; i < Integer.MAX_VALUE; i++) {
Expand Down

1 comment on commit d3534b0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.