InputStreamReader
An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.
Method | Description |
---|---|
int available() | Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. |
void close() | Closes this input stream and releases any system resources associated with the stream. |
void mark(int) | Marks the current position in this input stream. |
boolean markSupported() | Tests if this input stream supports the mark and reset
methods. |
int read() | Reads the next byte of data from the input stream. |
int read(byte[]) | Reads some number of bytes from the input stream and stores them
into the buffer array b . |
int read(byte[], int, int) | Reads up to len bytes of data from the input stream
into an array of bytes. |
void reset() | Repositions this stream to the position at the time the mark
method was last called on this input stream. |
long skip(long) | Skips over and discards n bytes of data from this
input stream. |
Sno | Methods with Description |
---|---|
1 | public int read() This method reads the next byte of data from the InputStream. Returns an int as the next byte of data. If it is end of file then it returns -1. |
2 | public int read(byte[] r, int off, int len) This method reads upto len number of bytes starting from off from the input stream into an array. Returns the total number of bytes read. If end of file -1 will be returned. |
3 | public int available() Gives the number of bytes that can be read from this file input stream. Returns an int that gives the number of bytes to be read. |
4 | public void mark(int read) This sets the current marked position in the stream. The parameter gives the maximum limit of bytes that can be read before the marked position becomes invalid. |
5 | public long skip(long n) Skips n number of bytes from the stream. This returns the actual number of bytes skipped. |
Sno | Method & Description |
---|---|
1 |
int read(byte[] b) This method reads some number of bytes from the contained input stream and stores them into the buffer array b |
2 |
int read(byte[] b, int off, int len) This method reads up to len bytes of data from the contained input stream into an array of bytes. |
3 |
boolean readBoolean() This method reads one input byte and returns true if that byte is nonzero, false if that byte is zero. |
4 |
byte readByte() This method reads and returns one input byte. |
5 |
char readChar() This method reads two input bytes and returns a char value. |
6 |
double readDouble() This method reads eight input bytes and returns a double value. |
7 |
float readFloat() This method reads four input bytes and returns a float value. |
8 |
void readFully(byte[] b) This method reads some bytes from an input stream and stores them into the buffer array b. |
9 |
void readFully(byte[] b, int off, int len) This method reads len bytes from an input stream. |
10 |
int readInt() This method reads four input bytes and returns an int value. |
11 |
long readLong() This method reads eight input bytes and returns a long value. |
12 |
short readShort() This method reads two input bytes and returns a short value. |
13 |
int readUnsignedByte() This method reads one input byte, zero-extends it to type int, and returns the result, which is therefore in the range 0 through 255. |
14 |
int readUnsignedShort() This method reads two input bytes and returns an int value in the range 0 through 65535. |
15 |
String readUTF() This method reads in a string that has been encoded using a modified UTF-8 format. |
16 |
static String readUTF(DataInput in) This method reads from the stream in a representation of a Unicode character string encoded in modified UTF-8 format; this string of characters is then returned as a String. |
17 |
int skipBytes(int n) This method makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes. |