public class InputStreamReader
extends java.io.Reader
InputStreamReader contains a buffer
 of bytes read from the source stream and converts these into characters as
 needed. The buffer size is 8K.OutputStreamWriter| Constructor and Description | 
|---|
| InputStreamReader(java.io.InputStream in)Constructs a new  InputStreamReaderon theInputStreamin. | 
| InputStreamReader(java.io.InputStream in,
                 java.nio.charset.Charset charset)Constructs a new InputStreamReader on the InputStream  inand
 Charsetcharset. | 
| InputStreamReader(java.io.InputStream in,
                 java.nio.charset.CharsetDecoder dec)Constructs a new InputStreamReader on the InputStream  inand
 CharsetDecoderdec. | 
| InputStreamReader(java.io.InputStream in,
                 java.lang.String enc)Constructs a new InputStreamReader on the InputStream  in. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Closes this reader. | 
| java.lang.String | getEncoding()Returns the name of the encoding used to convert bytes into characters. | 
| int | read()Reads a single character from this reader and returns it as an integer
 with the two higher-order bytes set to 0. | 
| int | read(char[] buf,
    int offset,
    int length)Reads at most  lengthcharacters from this reader and stores them
 at positionoffsetin the character arraybuf. | 
| boolean | ready()Indicates whether this reader is ready to be read without blocking. | 
public InputStreamReader(java.io.InputStream in)
InputStreamReader on the InputStream
 in. This constructor sets the character converter to the encoding
 specified in the "file.encoding" property and falls back to ISO 8859_1
 (ISO-Latin-1) if the property doesn't exist.in - the input stream from which to read characters.public InputStreamReader(java.io.InputStream in,
                         java.lang.String enc)
                  throws java.io.UnsupportedEncodingException
in. The
 character converter that is used to decode bytes into characters is
 identified by name by enc. If the encoding cannot be found, an
 UnsupportedEncodingException error is thrown.in - the InputStream from which to read characters.enc - identifies the character converter to use.java.lang.NullPointerException - if enc is null.java.io.UnsupportedEncodingException - if the encoding specified by enc cannot be found.public InputStreamReader(java.io.InputStream in,
                         java.nio.charset.CharsetDecoder dec)
in and
 CharsetDecoder dec.in - the source InputStream from which to read characters.dec - the CharsetDecoder used by the character conversion.public InputStreamReader(java.io.InputStream in,
                         java.nio.charset.Charset charset)
in and
 Charset charset.in - the source InputStream from which to read characters.charset - the Charset that defines the character converterpublic void close()
           throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerjava.io.IOException - if an error occurs attempting to close this reader.public java.lang.String getEncoding()
null is returned if this reader has been closed.null if this
         reader is closed.public int read()
         throws java.io.IOException
read in class java.io.Readerjava.io.IOException - if this reader is closed or some other I/O error occurs.public int read(char[] buf,
                int offset,
                int length)
         throws java.io.IOException
length characters from this reader and stores them
 at position offset in the character array buf. Returns
 the number of characters actually read or -1 if the end of the reader has
 been reached. The bytes are either obtained from converting bytes in this
 reader's buffer or by first filling the buffer from the source
 InputStream and then reading from the buffer.read in class java.io.Readerbuf - the array to store the characters read.offset - the initial position in buf to store the characters
            read from this reader.length - the maximum number of characters to read.java.lang.IndexOutOfBoundsException - if offset < 0 or length < 0, or if
             offset + length is greater than the length of
             buf.java.io.IOException - if this reader is closed or some other I/O error occurs.public boolean ready()
              throws java.io.IOException
true, the next read() will not block. If
 the result is false then this reader may or may not block when
 read() is called. This implementation returns true if
 there are bytes available in the buffer or the source stream has bytes
 available.ready in class java.io.Readertrue if the receiver will not block when read()
         is called, false if unknown or blocking will occur.java.io.IOException - if this reader is closed or some other I/O error occurs.Copyright © 2018. All Rights Reserved.