jxUtil 0.6

org.sourceforge.jxutil.io
Class FramedByteArrayInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.ByteArrayInputStream
              |
              +--org.sourceforge.jxutil.io.FramedByteArrayInputStream

public final class FramedByteArrayInputStream
extends ByteArrayInputStream

Version:
$Revision: 1.2 $, $Date: 2002/03/18 19:17:38 $
Author:
Keve Müller

Field Summary
private static byte[] EMPTY
          An empty buffer.
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
FramedByteArrayInputStream()
          Construct the stream with an empty buffer.
 
Method Summary
 byte[] getBuf()
          Return the buffer.
 void readFrom(byte[] buf)
          Replace the current buffer with given bytes.
 void readFrom(int len, DataInput in)
          Replace the current buffer with bytes read from the stream.
 void readFrom(int len, InputStream in)
          Replace the current buffer with bytes read from the stream.
 
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

private static final byte[] EMPTY
An empty buffer.

Constructor Detail

FramedByteArrayInputStream

public FramedByteArrayInputStream()
Construct the stream with an empty buffer.

Method Detail

getBuf

public byte[] getBuf()
Return the buffer.

Returns:
the current buffer (live copy)

readFrom

public void readFrom(byte[] buf)
Replace the current buffer with given bytes.

Parameters:
buf - the new buffer

readFrom

public void readFrom(int len,
                     DataInput in)
              throws IOException
Replace the current buffer with bytes read from the stream.

Parameters:
len - the new buffer's length
in - the DataInput to read from
Throws:
IOException - if an I/O error occurs

readFrom

public void readFrom(int len,
                     InputStream in)
              throws IOException
Replace the current buffer with bytes read from the stream.

Parameters:
len - the new buffer's length
in - the InputStream to read from
Throws:
IOException - if an I/O error occurs

jxUtil 0.6

Copyright © 2001,2002 Keve Müller, et al.; see LICENSE file for details.