JDK-4916565 : (spec) PrintStream does not document use of charset consistently
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-09-03
  • Updated: 2020-10-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
Name: rmT116609			Date: 09/03/2003


A DESCRIPTION OF THE PROBLEM :
A constructor of java.io.PrintStream accepts an encoding parameter. The documentation for this constructor does not provide any information of where the encoding is used.

Also, it seems the encoding is used for converting string/int to bytes while writing. However, all the write functions do not mention about this encoding at all. In fact, the documentation for these functions say that the platform's encoding is used for converting string/int to bytes. According to me this is wrong, as these functions might be using the encoding specified by the user in the constructor.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1. The constructor documentation should be completed to specify how the "encoding" parameter is used.

2. All the write functions should mention that the string/int to bytes conversion uses the user-specified encoding when the PrintStream is created with an additional encoding parameter.



URL OF FAULTY DOCUMENTATION :
relative path - j2sdk1.4.2/docs/api/java/io/PrintStream.html
(Incident Review ID: 201636) 
======================================================================

Comments
EVALUATION The class javadoc has already been modified to mention the possibility of providing a charset during construction, but more changes are needed: 1. This spec says that all characters written by this class will use the provided charset or the platform's default character encoding. This is only true for print() and println(), not write(). 2. We should add a sentence to PrintStream(OutputStream, boolean, String) similar to that in PrintStream(String, String) to mention use of the charset. 3. The write(), print(), and println() methods should all reference the contents of the class javadoc from item (1). Similar changes may also be necessary in PrintWriter.
02-11-2005

EVALUATION The PrintStream documentation does seem to be lacking with regards to the effect of the supplied encoding. ###@###.### 2003-10-23
23-10-2003