<!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.PushbackInputStream
</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.PrintWriter.html#_top_">Previous</a>  <a href="java.io.PushbackReader.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.io.PushbackInputStream
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.io.InputStream.html#_top_">java.io.InputStream</a>
           |
           +----<a href="java.io.FilterInputStream.html#_top_">java.io.FilterInputStream</a>
                   |
                   +----java.io.PushbackInputStream
</pre>
<hr>
<dl>
  <dt> public class <b>PushbackInputStream</b>
  <dt> extends <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
</dl>
This class is an input stream filter that provides a buffer into which data
 can be "unread."  An application may unread data at any time by pushing it
 back into the buffer, as long as the buffer has sufficient room.  Subsequent
 reads will read all of the pushed-back data in the buffer before reading
 from the underlying input stream.
 <p>
 This functionality is useful when a fragment of code should read 
 an indefinite number of data bytes that are delimited by 
 particular byte values. After reading the terminating byte the
 code fragment can push it back, so that the next read 
 operation on the input stream will re-read that byte.
<p>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#buf"><b>buf</b></a>
  <dd>  The pushback buffer.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#pos"><b>pos</b></a>
  <dd>  The position within the pushback buffer from which the next byte will
 be read.
</dl>
<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="#PushbackInputStream(java.io.InputStream)"><b>PushbackInputStream</b></a>(InputStream)
  <dd>  Creates a new pushback input stream with a one-byte pushback buffer.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#PushbackInputStream(java.io.InputStream, int)"><b>PushbackInputStream</b></a>(InputStream, int)
  <dd>  Creates a new pushback input stream with a pushback 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="#available()"><b>available</b></a>()
  <dd>  Returns the number of bytes that can be read from this input stream
 without blocking.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#markSupported()"><b>markSupported</b></a>()
  <dd>  Tests if this input stream supports the <code>mark</code> and
 <code>reset</code> methods, which it does not.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#read()"><b>read</b></a>()
  <dd>  Reads the next byte of data from this input stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#read(byte[], int, int)"><b>read</b></a>(byte[], int, int)
  <dd>  Reads up to <code>len</code> bytes of data from this input stream into
 an array of bytes.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#unread(byte[])"><b>unread</b></a>(byte[])
  <dd>  Pushes back an array of bytes by copying it to the front of the
 pushback buffer.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#unread(byte[], int, int)"><b>unread</b></a>(byte[], int, int)
  <dd>  Pushes back a portion of an array of bytes by copying it to the front
 of the pushback buffer.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#unread(int)"><b>unread</b></a>(int)
  <dd>  Pushes back a byte by copying it to the front of the pushback buffer.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="buf"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>buf</b>
<pre>
 protected byte buf[]
</pre>
<dl>
  <dd> The pushback buffer.<p>
</dl>
<a name="pos"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>pos</b>
<pre>
 protected int pos
</pre>
<dl>
  <dd> The position within the pushback buffer from which the next byte will
 be read.  When the buffer is empty, <code>pos</code> is equal to
 <code>buf.length</code>; when the buffer is full, <code>pos</code> is
 equal to zero.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="PushbackInputStream"></a>
<a name="PushbackInputStream(java.io.InputStream, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>PushbackInputStream</b>
<pre>
 public PushbackInputStream(<a href="java.io.InputStream.html#_top_">InputStream</a> in,
                            int size)
</pre>
<dl>
  <dd> Creates a new pushback input stream with a pushback buffer
 of the specified size.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> in - the input stream from which bytes will be read.
    <dd> size - the size of the pushback buffer.
  </dl></dd>
</dl>
<a name="PushbackInputStream(java.io.InputStream)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>PushbackInputStream</b>
<pre>
 public PushbackInputStream(<a href="java.io.InputStream.html#_top_">InputStream</a> in)
</pre>
<dl>
  <dd> Creates a new pushback input stream with a one-byte pushback buffer.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> in - the input stream from which bytes will be read.
  </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> Reads the next byte of data from this input stream. The value 
 byte is returned as an <code>int</code> in the range 
 <code>0</code> to <code>255</code>. If no byte is available 
 because the end of the stream has been reached, the value 
 <code>-1</code> is returned. This method blocks until input data 
 is available, the end of the stream is detected, or an exception 
 is thrown. 
 <p> This method returns the most recently pushed-back byte, if there is
 one, and otherwise calls the <code>read</code> method of its underlying
 input stream and returns whatever value that method returns.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the next byte of data, or <code>-1</code> 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.FilterInputStream.html#read()">read</a> in class <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.InputStream.html#read()">read</a>
  </dl></dd>
</dl>
<a name="read(byte[], 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(byte b[],
                 int off,
                 int len) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Reads up to <code>len</code> bytes of data from this input stream into
 an array of bytes.  This method first reads any pushed-back bytes; after
 that, if fewer than than <code>len</code> bytes have been read then it
 reads from the underlying input stream.  This method blocks until at
 least 1 byte of input is available.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the buffer into which the data is read.
    <dd> off - the start offset of the data.
    <dd> len - the maximum number of bytes read.
    <dt> <b>Returns:</b>
    <dd> the total number of bytes read into the buffer, or
             <code>-1</code> if there is no more data because 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.FilterInputStream.html#read(byte[], int, int)">read</a> in class <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
  </dl></dd>
</dl>
<a name="unread(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="unread"><b>unread</b></a>
<pre>
 public void unread(int b) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Pushes back a byte by copying it to the front of the pushback buffer.
 After this method returns, the next byte to be read will have the value
 <code>(byte)b</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the <code>int</code> value whose low-order
 			byte is to be pushed back.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If there is not enough room in the pushback
			      buffer for the byte.
  </dl></dd>
</dl>
<a name="unread(byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="unread"><b>unread</b></a>
<pre>
 public void unread(byte b[],
                    int off,
                    int len) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Pushes back a portion of an array of bytes by copying it to the front
 of the pushback buffer.  After this method returns, the next byte to be
 read will have the value <code>b[off]</code>, the byte after that will
 have the value <code>b[off+1]</code>, and so forth.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the byte array to push back.
    <dd> off - the start offset of the data.
    <dd> len - the number of bytes to push back.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If there is not enough room in the pushback
			      buffer for the specified number of bytes.
  </dl></dd>
</dl>
<a name="unread(byte[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="unread"><b>unread</b></a>
<pre>
 public void unread(byte b[]) throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Pushes back an array of bytes by copying it to the front of the
 pushback buffer.  After this method returns, the next byte to be read
 will have the value <code>b[0]</code>, the byte after that will have the
 value <code>b[1]</code>, and so forth.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> b - the byte array to push back
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> If there is not enough room in the pushback
			      buffer for the specified number of bytes.
  </dl></dd>
</dl>
<a name="available()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="available"><b>available</b></a>
<pre>
 public int available() throws <a href="java.io.IOException.html#_top_">IOException</a>
</pre>
<dl>
  <dd> Returns the number of bytes that can be read from this input stream
 without blocking.  This method calls the <code>available</code> method
 of the underlying input stream; it returns that value plus the number of
 bytes that have been pushed back.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the number of bytes that can be read from the input stream
             without blocking.
    <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.FilterInputStream.html#available()">available</a> in class <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.FilterInputStream.html#in">in</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> Tests if this input stream supports the <code>mark</code> and
 <code>reset</code> methods, which it does not.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> <code>false</code>, since this class does not support the
           <code>mark</code> and <code>reset</code> methods.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.FilterInputStream.html#markSupported()">markSupported</a> in class <a href="java.io.FilterInputStream.html#_top_">FilterInputStream</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.InputStream.html#mark(int)">mark</a>, <a href="java.io.InputStream.html#reset()">reset</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.PrintWriter.html#_top_">Previous</a>  <a href="java.io.PushbackReader.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
