I have read about FileInputStream and I found that it have read method where it will read the byte data of the file.
What I want to know is what types of byte data does it read? Meaning does it use ASCII or Unicode or any other types?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as
FileInputStreamand its methods are concerned, there is only one “type” of data. And that type is “a sequence of bytes (or octets)”.Any other “types” are for another library (or application code) layer to deal with.
The “types” you refer to as ASCII and Unicode are character encodings (roughly speaking). (In fact, Unicode is NOT an encoding at all … and doesn’t exactly make sense in this context. Encodings for Unicode have names like “UTF-8” and “UTF-16” and so on – see http://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings.)
Anyway, the standard way to “deal” with text file types (i.e. sequences of characters in some standard character encoding scheme) is to use a
Readerclass. And there is a wrapper class calledInputStreamReaderthat is specifically designed for reading character data from anInputStream.Other non-textual “types” of data are handled by classes like
ZipInputStream,InflaterInputStream,GZIPInputStream, the image reader classes, and so on.