JDK-4833833 : (spec) PrintWriter incorrectly describes character conversion
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.1
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2003-03-18
  • 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: nl37777			Date: 03/17/2003


The specifications of all PrintWriter.print methods say that text "is 
translated into bytes according to the platform��s default character 
encoding, and these bytes are written in exactly the manner of the 
java.io.Writer.write(int) method."

There are several problems with this:
- PrintWriter doesn't do any character conversion itself. It formats a 
variety of data types and passes the resulting character sequences on to 
an underlying writer.
- When eventually character conversion is performed, it may or may not 
use the default character encoding.
- The java.io.Writer.write(int) method doesn't take bytes, it takes a 
Unicode character.
- The print and write methods don't actually go through write(int); they 
use several different methods on the underlying writer, and according to 
the Writer class description the main bottleneck is the write(char[], 
int, int) method.

A correct specification would be that the text "is written to the 
underlying Writer."
======================================================================

Comments
EVALUATION The submitter is, essentially, correct. -- ###@###.### 2003/3/17
03-11-0183