Sujet : Re: New VSI post on Youtube
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 20. Aug 2024, 15:15:03
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <va28d7$3cunf$3@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Mozilla Thunderbird
On 8/20/2024 8:29 AM, Simon Clubley wrote:
At times, Java itself seems to "feel" like it has been designed by theorists
with little real-world experience. All the classes-upon-classes when doing
I/O come to mind here.
JCP is just like ANSI, ISO and ECMA.
Java is literally designed by committee.
And there are some horror decisions. The compiler API comes
to my mind - it takes 200 lines to do what you can do in 5 lines
in C#.
The java.io package may seem a bit complex, but it makes perfect
sense when you learn the structure.
The basics is:
InputStream - read bytes from anything
FileInputStream - read bytes from file
ByteArrayInputStream - read bytes from byte array
...
OutputStream - write bytes to anything
FileOutputStream - write bytes to file
ByteArrayOutputStream - write bytes to byte array
...
Reader - read chars according to encoding from anything
FileReader - read chars according to encoding from file
CharArrayReader - read chars according to encoding from char array
...
Writer - write chars according to encoding to anything
FileWriter - write chars according to encoding to file
CharArrayWriter - write chars according to encoding to char array
...
All very systematic.
On top of that there are two convenience classes to work with text
files:
* BufferedReader that wraps any Reader and provides a readLine method
* PrintWriter that wraps any Writer and provides print, println and
printf methods
Remember that and you can handle 98% of cases.
For the last 2% reading the docs will be needed.
Arne