I'm having some difficulty digesting the some concepts in the Java IO classes. For instance there are two types of streams, byte and char. Byte streams as I understand read byte by byte.
1. If a char in java is stored as a 16bit (two byte) data type, how is it possible for me to accurately read a char, say 'A', from a file using a byte oriented input stream eg. FileInputStream?
2. Is it that the chars I used (mostly between 0 and 122 on the ascii chart) are stored in one byte of the two bytes allocated?
3. DataInputStream/DataOutputStream allows me to read and write binary data, other input streams like FileInputStream/FileOutputStream allows me to read and write what exactly? I basically want to know which stream to use when I wish to output data as text I can read (using a simple text editor like notepad) versus when I want it encoded as raw binary data (text that looks like garbage in notepad)?
Struggling to understand the concept of streams in java and which to use when.