Can we improve the charset parameter Javadoc in PrintStream?

Daniel Schmid daniel at wwwmaster.at
Wed May 29 11:09:44 UTC 2024


Hi,

When viewing the Javadoc of PrintStream, I noticed that the Javadocs of 
the constructors involving charsets seems to be a bit lacking.
In most cases, these just mention something like "a charset" instead of 
saying what it's used for. While the class description specifies that, I 
think it could also be present in the parameter information of the 
constructors since PrintStream is a commonly used class.

- The second parameter of PrintStream(File, String) is named "csn" and 
described as "The name of a supported charset". I suggest naming the 
parameter "encoding" and changing the description to "The name of a 
supported character encoding to be used for be used for converting 
characters to bytes" (with the appropriate link). This would be 
consistent with the PrintStream(OutputStream, boolean, String) constructor.
- The second parameter of PrintStream(File, Charset) is described as "A 
charset". I think this could be changed to "The charset used for 
converting characters to bytes" or similar.
- The third parameter of PrintStream(OutputStream, boolean, String) is 
named "encoding" and described as "The name of a supported character 
encoding". This could be changed to "The name of a supported character 
encoding to be used for be used for converting characters to bytes".
- The third parameter of PrintStream(OutputStream, boolean, Charset) is 
described as "A charset". I suggest changing this to "The charset used 
for converting characters to bytes".

Instead of using "encoding" for the String parameter names, 
"charsetName" would be another option. In this case, I would suggest 
something like "The name of a supported charset to be used for be used 
for converting characters to bytes".

If wanted, I can write a pull request for this but as I don't have JBS 
access, I can't create the issue and CSR by myself.

Yours,
Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4490 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20240529/2d207913/smime.p7s>


More information about the core-libs-dev mailing list