In this example we are going to convert input stream to byte. Here we are going to read input stream and converting it into bytes. To do so first read the input stream from dos prompt then store it into an integer. Finally type cast the integer value into byte.
The System class provides references for the standard
input, output and error streams. They are given below:
1.InputStream : This is used to take the input stream .The System class
provides references for the standard input by System.in.
2.OutputStream: This is used to show the output stream. The System class uses System.out stream to refer to the standard output.
3.OutputStream: This is used to show the error as output stream. The System class provides references for the standard output by System.err.
The code of the program is given below:
import java.io.*;
|
The output of the program is given below:
C:\rajesh>javac InstramToByteExample.java C:\rajesh>java InstramToByteExample rajesh kumar The value of byte array114 |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Convert InputStream to Byte
Post your Comment