Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.message.util
Class WireByteArrayInputStream

    java.lang.Object
      java.io.InputStream
          java.io.ByteArrayInputStream
              org.codehaus.activemq.message.util.WireByteArrayInputStream

public class WireByteArrayInputStream
extends ByteArrayInputStream

Optimized ByteArrayInputStream that can be used more than once. Which is nice.

Version:
  $Revision: 1.1 $

Field Summary

Fields inherited from class java.io.ByteArrayInputStream
`buf, count, mark, pos`

Constructor Summary
`WireByteArrayInputStream()` Creates `WireByteArrayInputStream` with a minmalist byte array
`WireByteArrayInputStream(byte[] buf)` Creates a `WireByteArrayInputStream`.
`WireByteArrayInputStream(byte[] buf, int offset, int length)` Creates `WireByteArrayInputStream` that uses `buf` as its buffer array.

Method Summary
`int` | `available()`
`int` | `read()` Reads the next byte of data from this input stream.
`int` | `read(byte[] b, int off, int len)` Reads up to `len` bytes of data into an array of bytes from this input stream.
`void` | `restart(byte[] newBuff)` reset the `WireByteArrayInputStream` to use an new byte array
`void` | `restart(byte[] newBuff, int offset, int length)` reset the `WireByteArrayInputStream` to use an new byte array

Methods inherited from class java.io.ByteArrayInputStream
`close, mark, markSupported, 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`

Constructor Detail

### WireByteArrayInputStream

    public WireByteArrayInputStream(byte[] buf)

  Creates a `WireByteArrayInputStream`.

Parameters:
  `buf` - the input buffer.

### WireByteArrayInputStream

    public WireByteArrayInputStream(byte[] buf,
                                    int offset,
                                    int length)

  Creates `WireByteArrayInputStream` that uses `buf` as its buffer array.

Parameters:
  `buf` - the input buffer.
  `offset` - the offset in the buffer of the first byte to read.
  `length` - the maximum number of bytes to read from the buffer.

### WireByteArrayInputStream

    public WireByteArrayInputStream()

  Creates `WireByteArrayInputStream` with a minmalist byte array

Method Detail

### restart

    public void restart(byte[] newBuff,
                        int offset,
                        int length)

  reset the `WireByteArrayInputStream` to use an new byte array

  Parameters:
    `newBuff` - buffer to use
    `offset` - the offset in the buffer of the first byte to read.
    `length` - the maximum number of bytes to read from the buffer.

### restart

    public void restart(byte[] newBuff)

  reset the `WireByteArrayInputStream` to use an new byte array

  Parameters:
    `newBuff` -

### read

    public int read()

  Reads the next byte of data from this input stream. The value byte is returned as an `int` in the range `0` to `255`. If no byte is available because the end of the stream has been reached, the value `-1` is returned.

  This `read` method cannot block.

  Returns:
    the next byte of data, or `-1` if the end of the stream has been reached.

### read

    public int read(byte[] b,
                    int off,
                    int len)

  Reads up to `len` bytes of data into an array of bytes from this input stream.

  Parameters:
    `b` - the buffer into which the data is read.
    `off` - the start offset of the data.
    `len` - the maximum number of bytes read.
  Returns:
    the total number of bytes read into the buffer, or `-1` if there is no more data because the end of the stream has been reached.

### available

    public int available()

  Returns:
    the number of bytes that can be read from the input stream without blocking.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Protique, Ltd.. All Rights Reserved.