- Java.io package classes
- Java.io - Home
- Java.io - BufferedInputStream
- Java.io - BufferedOutputStream
- Java.io - BufferedReader
- Java.io - BufferedWriter
- Java.io - ByteArrayInputStream
- Java.io - ByteArrayOutputStream
- Java.io - CharArrayReader
- Java.io - CharArrayWriter
- Java.io - Console
- Java.io - DataInputStream
- Java.io - DataOutputStream
- Java.io - File
- Java.io - FileDescriptor
- Java.io - FileInputStream
- Java.io - FileOutputStream
- Java.io - FilePermission
- Java.io - FileReader
- Java.io - FileWriter
- Java.io - FilterInputStream
- Java.io - FilterOutputStream
- Java.io - FilterReader
- Java.io - FilterWriter
- Java.io - InputStream
- Java.io - InputStreamReader
- Java.io - LineNumberInputStream
- Java.io - LineNumberReader
- Java.io - ObjectInputStream
- Java.io - ObjectInputStream.GetField
- Java.io - ObjectOutputStream
- io - ObjectOutputStream.PutField
- Java.io - ObjectStreamClass
- Java.io - ObjectStreamField
- Java.io - OutputStream
- Java.io - OutputStreamWriter
- Java.io - PipedInputStream
- Java.io - PipedOutputStream
- Java.io - PipedReader
- Java.io - PipedWriter
- Java.io - PrintStream
- Java.io - PrintWriter
- Java.io - PushbackInputStream
- Java.io - PushbackReader
- Java.io - RandomAccessFile
- Java.io - Reader
- Java.io - SequenceInputStream
- Java.io - SerializablePermission
- Java.io - StreamTokenizer
- Java.io - StringBufferInputStream
- Java.io - StringReader
- Java.io - StringWriter
- Java.io - Writer
- Java.io package Useful Resources
- Java.io - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
85 Lectures 6 hours
The Java.io.BufferedInputStream class adds functionality to another input stream, the ability to buffer the input and to support the mark and reset methods. Following are the important points about BufferedInputStream −
When the BufferedInputStream is created, an internal buffer array is created.
As bytes from the stream are read or skipped, the internal buffer is refilled as necessary from the contained input stream, many bytes at a time.
Following is the declaration for Java.io.BufferedInputStream class −
public class BufferedInputStream extends FilterInputStream
Following are the fields for Java.io.BufferedInputStream class −
protected byte buf − This is the internal buffer array where the data is stored.
protected int count − This is the index one greater than the index of the last valid byte in the buffer.
protected int marklimit − This is the maximum read ahead allowed after a call to the mark method before subsequent calls to the reset method fail.
protected int markpos − This is the value of the pos field at the time the last mark method was called.
protected int pos − This is the current position in the buffer.
protected InputStream in − This is the input stream to be filtered.
|Sr.No.||Constructor & Description|
This creates a BufferedInputStream and saves its argument, the input stream in, for later use.
BufferedInputStream(InputStream in, int size)
This creates a BufferedInputStream with the specified buffer size, and saves its argument, the input stream in, for later use.
|Sr.No.||Method & Description|
This method returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.
This method closes this input stream and releases any system resources associated with the stream.
|3||void mark(int readlimit)
This method see the general contract of the mark method of InputStream.
This method tests if this input stream supports the mark and reset methods.
This method reads the next byte of data from the input stream.
|6||int read(byte b, int off, int len)
This method reads bytes from this byte-input stream into the specified byte array, starting at the given offset.
This method repositions this stream to the position at the time the mark method was last called on this input stream.
|8||long skip(long n)
This method skips over and discards n bytes of data from this input stream.
This class inherits methods from the following classes −