Liste des Groupes | Revenir à co vms |
On 2024-08-20, Arne Vajhøj <arne@vajhoej.dk> wrote:Reader/Writer does not extend InputStream/OutputStream. They do notOn 8/20/2024 1:38 PM, Simon Clubley wrote:I may not have stated that clearly enough.After all, why miss the opportunity to have two parallel sets of APIs>
(byte versus character) instead of just the one API ? :-)
>
Goodness knows why they didn't just add something like String's getBytes()
method to the character APIs or add character support to the byte APIs...
Because InputStream/OutputStream and Reader/Writer are fundamentally
different.
>
The character model is built in top of a byte model, with character-specific
knowledge in the character classes.
The traditional Java way to add this additional functionality is to extend
a class in a subclass and implement the additional functionality in the
subclass.
I am having a hard time seeing why they didn't just extend the byte I/OMixing byte IO and character IO can be very dangerous (at least
classes in this way to implement additional character functionality so
that both character and byte I/O directly uses an InputStream (and likewise
for an OutputStream). There should be no need for a character-specific
Reader concept or an InputStreamReader() converter.
Les messages affichés proviennent d'usenet.