7093322: (fs spec) Files.newBufferedWriter should be clear when coding errors are detected

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2022-12-15 17:27:39 +00:00
parent 0288210f25
commit 831b35fad3

View File

@ -2938,7 +2938,12 @@ public final class Files {
* a size of {@code 0} if it exists.
*
* <p> The {@code Writer} methods to write text throw {@code IOException}
* if the text cannot be encoded using the specified charset.
* if the text cannot be encoded using the specified charset. Due to
* buffering, an {@code IOException} caused by an encoding error
* (unmappable-character or malformed-input) may be thrown when {@linkplain
* BufferedWriter#write(char[],int,int) writing}, {@linkplain
* BufferedWriter#flush flushing}, or {@linkplain BufferedWriter#close
* closing} the buffered writer.
*
* @param path
* the path to the file