Skip to content

Commit a1be297

Browse files
author
Brian Burkhalter
committed
8369854: (ch) Refine specification of behavior of {Gathering,Writable}ByteChannel.write
Reviewed-by: alanb
1 parent 257bb2b commit a1be297

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/java.base/share/classes/java/nio/channels/GatheringByteChannel.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, 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
@@ -76,11 +76,14 @@ public interface GatheringByteChannel
7676
* the final position of each updated buffer, except the last updated
7777
* buffer, is guaranteed to be equal to that buffer's limit.
7878
*
79-
* <p> Unless otherwise specified, a write operation will return only after
79+
* <p> For many types of channels, a write operation will return only after
8080
* writing all of the <i>r</i> requested bytes. Some types of channels,
8181
* depending upon their state, may write only some of the bytes or possibly
82-
* none at all. A socket channel in non-blocking mode, for example, cannot
83-
* write any more bytes than are free in the socket's output buffer.
82+
* none at all. A socket channel in {@linkplain
83+
* SelectableChannel#isBlocking non-blocking mode}, for example, cannot
84+
* write any more bytes than are free in the socket's output buffer. The
85+
* write method may need to be invoked more than once to ensure that all
86+
* {@linkplain ByteBuffer#hasRemaining remaining} bytes are written.
8487
*
8588
* <p> This method may be invoked at any time. If another thread has
8689
* already initiated a write operation upon this channel, however, then an

src/java.base/share/classes/java/nio/channels/WritableByteChannel.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, 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
@@ -65,11 +65,14 @@ public interface WritableByteChannel
6565
* Upon return the buffer's position will be equal to
6666
* <i>p</i>&nbsp;{@code +}&nbsp;<i>n</i>; its limit will not have changed.
6767
*
68-
* <p> Unless otherwise specified, a write operation will return only after
68+
* <p> For many types of channels, a write operation will return only after
6969
* writing all of the <i>r</i> requested bytes. Some types of channels,
7070
* depending upon their state, may write only some of the bytes or possibly
71-
* none at all. A socket channel in non-blocking mode, for example, cannot
72-
* write any more bytes than are free in the socket's output buffer.
71+
* none at all. A socket channel in {@linkplain
72+
* SelectableChannel#isBlocking non-blocking mode}, for example, cannot
73+
* write any more bytes than are free in the socket's output buffer. The
74+
* write method may need to be invoked more than once to ensure that all
75+
* {@linkplain ByteBuffer#hasRemaining remaining} bytes are written.
7376
*
7477
* <p> This method may be invoked at any time. If another thread has
7578
* already initiated a write operation upon this channel, however, then an

0 commit comments

Comments
 (0)