In java people say inputstream reads a file byte by byte then using buffered reader they change to characterstream.But in C char refer to byte(8 bit).Then what we call as character and byte in java.
3 Answers
In Java a byte
is a signed 8-bit value, and a char
is an unsigned 16-bit value. The Character
is both a wrapper type for char
and a utility class for a number of useful method supporting char
The key difference between an InputSTream is that it reads binary data, one byte at a time. A Reader
is for reading text and it decodes bytes into char
using the character encoding you set or the default encoding e.g. UTF-8
can turn 1, 2 or 3 bytes into a single char
.
I suggest you learn more about the very basics of Java. It will save you a lot of time with these sort of questions.

- 525,659
- 79
- 751
- 1,130
For the C/C++ part, in those languages, a char is guaranteed to be at least 8 bits, so a char is at least as wide as a byte. I have been coding C since 1990 and C++ since 1992, and I have never seen a real platform/compiler combination where char and byte are not equivalent.
Also note that the other integer types are signed unless otherwise specified (e.g. 'int' is a signed integer), but 'char' is equivalent to 'unsigned char'.

- 2,585
- 1
- 14
- 25
A stream is a way of sequentially accessing a file. In Streams you can process the data one at a time as bulk operations are unavailable with them. But, streams supports a huge range of source and destinations including disk file, arrays, other devices, other programs etc. In Java, a byte is not the same thing as a char . Therefore a byte stream is different from a character stream. So, Java defines two types of streams: Byte Streams and Character Streams .
Byte Streams
A byte stream access the file byte by byte. Java programs use byte streams to perform input and output of 8-bit bytes. It is suitable for any kind of file, however not quite appropriate for text files. For example, if the file is using a unicode encoding and a character is represented with two bytes, the byte stream will treat these separately and you will need to do the conversion yourself. Byte oriented streams do not use any encoding scheme while Character oriented streams use character encoding scheme(UNICODE). All byte stream classes are descended from InputStream and OutputStream .