Byte is a binary stream and character are text streams. When you think about it, anything in the computer is only represented by "on" and "off" states in memory, so realistically all things other than a binary, byte, stream are just a formatting construct laid over a binary, byte, stream.
s sivaraman wrote:Thanks for the reply.
i dont know what do you mean by binary and text.
so far as what i read , i infer that there are two streams byte and character.
correct me i'm wrong? could you!
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
A computer can really only work with bits and bytes - binary data. The memory (RAM) and harddisk of a computer can only store bytes.
Text is represented in the computer's memory by using numbers. We use a character encoding to determine what number means what text character. For example, if we use the ASCII character encoding, then A = 65, B = 66, C = 67, etc. When a computer stores text in memory on in a file, then it stores the numbers - and through the character encoding we know what these numbers mean. There are different character encodings besides ASCII. Other character encodings that are used frequently are UTF-8, UTF-16 and ISO-8859-1. Note that not all character encodings use exactly 1 byte for each character. For example UTF-8 is a variable-length character encoding; it uses between 1 and 4 bytes to store a character.
Java has two kinds of classes for I/O: streams and readers / writers.
Streams: class java.io.InputStream, class java.io.OutputStream and their subclasses, are for reading and writing binary data - bytes. They just read and write directly the numbers that are stored.
Readers and writers: class java.io.Reader, class java.io.Writer and their subclasses, are for reading and writing text. They are just a wrapper around InputStream and OutputStream, using a character encoding to convert characters to bytes and vice versa.