<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.io.BufferedReader
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.io.html">This Package</a>  <a href="java.io.BufferedOutputStream.html#_top_">Previous</a>  <a href="java.io.BufferedWriter.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.io.BufferedReader
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.io.Reader.html#_top_">java.io.Reader</a>
           |
           +----java.io.BufferedReader
</pre>
<hr>
<dl>
  <dt> public class <b>BufferedReader</b>
  <dt> extends <a href="java.io.Reader.html#_top_">Reader</a>
</dl>
Read text from a character-input stream, buffering characters so as to
 provide for the efficient reading of characters, arrays, and lines.
 <p> The buffer size may be specified, or the default size may be used.  The
 default is large enough for most purposes.
 <p> In general, each read request made of a Reader causes a corresponding
 read request to be made of the underlying character or byte stream.  It is
 therefore advisable to wrap a BufferedReader around any Reader whose read()
 operations may be costly, such as FileReaders and InputStreamReaders.  For
 example,
 <pre>
 BufferedReader in
   = new BufferedReader(new FileReader("foo.in"));
 </pre>
 will buffer the input from the specified file.  Without buffering, each
 invocation of read() or readLine() could cause bytes to be read from the
 file, converted into characters, and then returned, which can be very
 inefficient. 
 <p> Programs that use DataInputStreams for textual input can be localized by
 replacing each DataInputStream with an appropriate BufferedReader.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FileReader.html#_top_">FileReader</a>, <a href="java.io.InputStreamReader.html#_top_">InputStreamReader</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BufferedReader(java.io.Reader)"><b>BufferedReader</b></a>(Reader)
  <dd>  Create a buffering character-input stream that uses a default-sized
 input buffer.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#BufferedReader(java.io.Reader, int)"><b>BufferedReader</b></a>(Reader, int)
  <dd>  Create a buffering character-input stream that uses an input buffer of
 the specified size.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#close()"><b>close</b></a>()
  <dd>  Close the stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#mark(int)"><b>mark</b></a>(int)
  <dd>  Mark the present position in the stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#markSupported()"><b>markSupported</b></a>()
  <dd>  Tell whether this stream supports the mark() operation, which it does.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#read()"><b>read</b></a>()
  <dd>  Read a single character.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#read(char[], int, int)"><b>read</b></a>(char[], int, int)
  <dd>  Read characters into a portion of an array.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#readLine()"><b>readLine</b></a>()
  <dd>  Read a line of text.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ready()"><b>ready</b></a>()
  <dd>  Tell whether this stream is ready to be read.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#reset()"><b>reset</b></a>()
  <dd>  Reset the stream to the most recent mark.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#skip(long)"><b>skip</b></a>(long)
  <dd>  Skip characters.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="BufferedReader"></a>
<a name="BufferedReader(java.io.Reader, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BufferedReader</b>
<pre>
 public BufferedReader(<a href="java.io.Reader.html#_top_">Reader</a> in,
                       int sz)
</pre>
<dl>
  <dd> Create a buffering character-input stream that uses an input buffer of
 the specified size.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> in - A Reader
    <dd> sz - Input-buffer size
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> If sz is <= 0
  </dl></dd>
</dl>
<a name="BufferedReader(java.io.Reader)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>BufferedReader</b>
<pre>
 public BufferedReader(<a href="java.io.Reader.html#_top_">Reader</a> in)
</pre>
<dl>
  <dd> Create a buffering character-input stream that uses a default-sized
 input buffer.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> in - A Reader
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="read()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="read"><b>read</b></a>
<pre>
 public int read() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Read a single character.
<p>
  <dd><dl>
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If an I/O error occurs
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#read()">read</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<a name="read(char[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="read"><b>read</b></a>
<pre>
 public int read(char cbuf[],
                 int off,
                 int len) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Read characters into a portion of an array.
 <p> Ordinarily this method takes characters from this stream's character
 buffer, filling it from the underlying stream as necessary.  If,
 however, the buffer is empty, the mark is not valid, and the requested
 length is at least as large as the buffer, then this method will read
 characters directly from the underlying stream into the given array.
 Thus redundant <code>BufferedReader</code>s will not copy data
 unnecessarily.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> cbuf - Destination buffer
    <dd> off - Offset at which to start storing characters
    <dd> len - Maximum number of characters to read
    <dt> <b>Returns:</b>
    <dd> The number of bytes read, or -1 if the end of the stream has
             been reached
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If an I/O error occurs
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#read(char[], int, int)">read</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<a name="readLine()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="readLine"><b>readLine</b></a>
<pre>
 public <a href="java.lang.String.html#_top_">String</a> readLine() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Read a line of text.  A line is considered to be terminated by any one
 of a line feed ('\n'), a carriage return ('\r'), or a carriage return
 followed immediately by a linefeed.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> A String containing the contents of the line, not including
             any line-termination characters, or null if the end of the
             stream has been reached
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If an I/O error occurs
  </dl></dd>
</dl>
<a name="skip(long)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="skip"><b>skip</b></a>
<pre>
 public long skip(long n) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Skip characters.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> n - The number of characters to skip
    <dt> <b>Returns:</b>
    <dd> The number of characters actually skipped
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If an I/O error occurs
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#skip(long)">skip</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<a name="ready()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="ready"><b>ready</b></a>
<pre>
 public boolean ready() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Tell whether this stream is ready to be read.  A buffered character
 stream is ready if the buffer is not empty, or if the underlying
 character stream is ready.
<p>
  <dd><dl>
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If an I/O error occurs
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#ready()">ready</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<a name="markSupported()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="markSupported"><b>markSupported</b></a>
<pre>
 public boolean markSupported()
</pre>
<dl>
  <dd> Tell whether this stream supports the mark() operation, which it does.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#markSupported()">markSupported</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<a name="mark(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="mark"><b>mark</b></a>
<pre>
 public void mark(int readAheadLimit) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Mark the present position in the stream.  Subsequent calls to reset()
 will attempt to reposition the stream to this point.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> readAheadLimit - Limit on the number of characters that may be
                         read while still preserving the mark.  After
                         reading this many characters, attempting to
                         reset the stream may fail.  A limit value larger
                         than the size of the input buffer will cause a
                         new buffer to be allocated whose size is no
                         smaller than limit.  Therefore large values
                         should be used with care.
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> If readAheadLimit is < 0
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If an I/O error occurs
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#mark(int)">mark</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<a name="reset()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="reset"><b>reset</b></a>
<pre>
 public void reset() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Reset the stream to the most recent mark.
<p>
  <dd><dl>
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If the stream has never been marked,
                          or if the mark has been invalidated
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#reset()">reset</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<a name="close()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="close"><b>close</b></a>
<pre>
 public void close() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Close the stream.
<p>
  <dd><dl>
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If an I/O error occurs
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.Reader.html#close()">close</a> in class <a href="java.io.Reader.html#_top_">Reader</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.io.html">This Package</a>  <a href="java.io.BufferedOutputStream.html#_top_">Previous</a>  <a href="java.io.BufferedWriter.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
