Someone explain to me what InputStream and OutputStream are?
I am confused about the use cases for both InputStream and OutputStream.
If you could also include a snippet of code to go along with your explanation, that would be great. Thanks!
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.
The goal of
InputStreamandOutputStreamis to abstract different ways to input and output: whether the stream is a file, a web page, or the screen shouldn’t matter. All that matters is that you receive information from the stream (or send information into that stream.)InputStreamis used for many things that you read from.OutputStreamis used for many things that you write to.Here’s some sample code. It assumes the
InputStream instrandOutputStream osstrhave already been created: