All About Class ByteArrayInputStream in Java



ByteArrayInputStream allows an application to create an input stream where the bytes read are supplied by the contents of a byte Array.Application can also read bytes from a String by using a StringBufferInputStream.

The structure of the class ByteArrayInputStream is given as:

public class java.io.ByteArrayInputStream extends java.io.InputStream{
//member elements:
protected byte buff[];
//the buffer consists of array of bytes containing the data.
protect int count;
//The index is greater than the last valid character in the input stream buffer.
protected int pos
//the index of the next character to read from the input stream buffer.
//Constructor
public ByteArrayInputStream(byte buf[]);
//creates a new byte array input stream which reads data from the specified byte array.
//The byte array is not copied
public ByteArrayInputStream(byte buf[],int offSet,int length);
//creates a new byte array input stream which reads data from the specified byte array upto
//length characters are to be read from the byte array starting at the indicated offSet.
//Methods:
public int available();
public int read();
public int read(byte b[],int offSet,int length);
public void reset();
public long skip(long l);
} 
All About Class ByteArrayInputStream in Java All About Class ByteArrayInputStream in Java Reviewed by Animesh Chatterjee on October 08, 2018 Rating: 5

No comments:

Powered by Blogger.