<!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.ByteArrayInputStream
</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.BufferedWriter.html#_top_">Previous</a>  <a href="java.io.ByteArrayOutputStream.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.io.ByteArrayInputStream
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.io.InputStream.html#_top_">java.io.InputStream</a>
           |
           +----java.io.ByteArrayInputStream
</pre>
<hr>
<dl>
  <dt> public class <b>ByteArrayInputStream</b>
  <dt> extends <a href="java.io.InputStream.html#_top_">InputStream</a>
</dl>
This class allows an application to create an input stream in 
 which the bytes read are supplied by the contents of a byte array. 
 Applications can also read bytes from a string by using a 
 <code>StringBufferInputStream</code>.
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.io.StringBufferInputStream.html#_top_">StringBufferInputStream</a>
</dl>
<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 byte array containing the data.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#count"><b>count</b></a>
  <dd>  The index one greater than the last valid character in the input 
 stream buffer.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#mark"><b>mark</b></a>
  <dd>  The currently marked position in the stream.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#pos"><b>pos</b></a>
  <dd>  The index of the next character to read from the input stream buffer.
</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="#ByteArrayInputStream(byte[])"><b>ByteArrayInputStream</b></a>(byte[])
  <dd>  Creates a new byte array input stream that reads data from the 
 specified byte array.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#ByteArrayInputStream(byte[], int, int)"><b>ByteArrayInputStream</b></a>(byte[], int, int)
  <dd>  Creates a new byte array input stream that reads data from the 
 specified byte array.
</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="#mark(int)"><b>mark</b></a>(int)
  <dd>  Set the current marked 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>  Tests if ByteArrayInputStream supports mark/reset.
  <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 into an array of bytes 
 from this input stream.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#reset()"><b>reset</b></a>()
  <dd>  Resets the buffer to the marked position.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#skip(long)"><b>skip</b></a>(long)
  <dd>  Skips <code>n</code> bytes of input from this input stream.
</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 byte array containing the data.<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 index of the next character to read from the input stream buffer.<p>
</dl>
<a name="mark"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>mark</b>
<pre>
 protected int mark
</pre>
<dl>
  <dd> The currently marked position in the stream.
 ByteArrayInputStreams are marked at position zero by
 default when constructed.  They may be marked at another
 position within the buffer by the <code>mark()</code> method.
 The current buffer position is set to this point by the
 <code>reset()</code> method.<p>
</dl>
<a name="count"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>count</b>
<pre>
 protected int count
</pre>
<dl>
  <dd> The index one greater than the last valid character in the input 
 stream buffer.<p>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="ByteArrayInputStream"></a>
<a name="ByteArrayInputStream(byte[])"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>ByteArrayInputStream</b>
<pre>
 public ByteArrayInputStream(byte buf[])
</pre>
<dl>
  <dd> Creates a new byte array input stream that reads data from the 
 specified byte array. The byte array is not copied.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> buf - the input buffer.
  </dl></dd>
</dl>
<a name="ByteArrayInputStream(byte[], int, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>ByteArrayInputStream</b>
<pre>
 public ByteArrayInputStream(byte buf[],
                             int offset,
                             int length)
</pre>
<dl>
  <dd> Creates a new byte array input stream that reads data from the 
 specified byte array. Up to <code>length</code> characters are to 
 be read from the byte array, starting at the indicated offset. 
 <p>
 The byte array is not copied.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> buf - the input buffer.
    <dd> offset - the offset in the buffer of the first byte to read.
    <dd> length - the maximum number of bytes to read from the buffer.
  </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 synchronized int read()
</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. 
 <p>
 The <code>read</code> method of <code>ByteArrayInputStream</code> 
 cannot block.
<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>Overrides:</b>
    <dd> <a href="java.io.InputStream.html#read()">read</a> in class <a href="java.io.InputStream.html#_top_">InputStream</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 synchronized int read(byte b[],
                              int off,
                              int len)
</pre>
<dl>
  <dd> Reads up to <code>len</code> bytes of data into an array of bytes 
 from this input stream. This <code>read</code> method cannot block.
<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>Overrides:</b>
    <dd> <a href="java.io.InputStream.html#read(byte[], int, int)">read</a> in class <a href="java.io.InputStream.html#_top_">InputStream</a>
  </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 synchronized long skip(long n)
</pre>
<dl>
  <dd> Skips <code>n</code> bytes of input from this input stream. Fewer 
 bytes might be skipped if the end of the input stream is reached.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> n - the number of bytes to be skipped.
    <dt> <b>Returns:</b>
    <dd> the actual number of bytes skipped.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.InputStream.html#skip(long)">skip</a> in class <a href="java.io.InputStream.html#_top_">InputStream</a>
  </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 synchronized int available()
</pre>
<dl>
  <dd> Returns the number of bytes that can be read from this input 
 stream without blocking. 
 <p>
 The <code>available</code> method of 
 <code>ByteArrayInputStream</code> returns the value of 
 <code>count&nbsp;- pos</code>, 
 which is the number of bytes remaining to be read from the input buffer.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the number of bytes that can be read from the input stream
          without blocking.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.InputStream.html#available()">available</a> in class <a href="java.io.InputStream.html#_top_">InputStream</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 ByteArrayInputStream supports mark/reset.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.InputStream.html#markSupported()">markSupported</a> in class <a href="java.io.InputStream.html#_top_">InputStream</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 markpos)
</pre>
<dl>
  <dd> Set the current marked position in the stream.
 ByteArrayInputStreams are marked at position zero by
 default when constructed.  They may be marked at another
 position within the buffer by this method.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.InputStream.html#mark(int)">mark</a> in class <a href="java.io.InputStream.html#_top_">InputStream</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 synchronized void reset()
</pre>
<dl>
  <dd> Resets the buffer to the marked position.  The marked position
 is the beginning unless another position was marked.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.io.InputStream.html#reset()">reset</a> in class <a href="java.io.InputStream.html#_top_">InputStream</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.BufferedWriter.html#_top_">Previous</a>  <a href="java.io.ByteArrayOutputStream.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
