All About Class BufferedInputStream in Java



BufferedInputStream class implements a buffered input Stream.By setting up such an input stream an application can read bytes from a stream without necessarily causing a call to the underlying System for each byte read. The data is read by blocks into buffer.

The structure of class BufferedInputStream is given below:

public class java.io.BufferedInputStream extends java.io.FilterInputStream{
//Member Elements
protected byte buf[];//A buffer array of bytes where data is stored
protected int count;//The index is one greater than the index of the last valid byte in the buffer
protected int markLimit;//The maximum read ahead allowed after a call to the mark method before 
//subsequent calls to the reset method fails.
protected int markPos;//The value of the pos filed at the time of the last mark method was called.
//The value of this field is -1 if there is no current mark.
protected int pos//the current position in the buffer. This is the index of the next character to 
//be read from the buffer array.
//Constructors
public BufferedInputStream(InputStream in)
//creates a new BufferedInputStream to read data from the specified InputStream in with a default
// 512 byte buffer size
public BufferedInputStream(InputStream in,int size)
//creates a new BufferedInputStream to read data from the specified InputStream with the specified
//byte of buffer size
//Methods:
public int available();
public void mark(int readLimit);
public boolean markSupported();
public int read();
public int read(byte buff[],int off,int len);
public void reset();
public long skip(long l)
}
 
All About Class BufferedInputStream in Java All About Class BufferedInputStream in Java Reviewed by Animesh Chatterjee on October 08, 2018 Rating: 5

No comments:

Powered by Blogger.