Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Convert InputStream to Byte 
 

This section provides you an example that converts input stream to byte. And what is input stream and converting it into bytes.

 

Convert InputStream to Byte

                         

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.*;
public class InstramToByteExample
{
public static void main(String args[]) throws IOException
  {
  int inputStream=System.in.read();
  int i=0;
  if (inputStream != -1
  {
    byte bValue = (byteinputStream;
  System.out.println("The value of byte array"+bValue);
    }
  }
}

The output of the program is given below:

C:\rajesh>javac InstramToByteExample.java
C:\rajesh>java InstramToByteExample
rajesh kumar
The value of byte array114

Download this example.

                         

» View all related tutorials
Related Tags: java c ide array class div io matrix get vi this id define ping for program to learn ram ear

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.