Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.io
Class MultiByteArrayInputStream

    java.lang.Object
      java.io.InputStream
          com.tangosol.io.MultiByteArrayInputStream

All Implemented Interfaces:
  InputStreaming, java.io.Closeable

    public class MultiByteArrayInputStream

extends java.io.InputStream
implements InputStreaming

Reads binary data from a series of byte arrays.

Author:
  cp 2001.11.03

Field Summary
`protected static byte[]` | `EMPTY_BYTES` Empty array of bytes.
`protected byte[][]` | `m_aabArray` The array of byte arrays.
`protected byte[]` | `m_ab` The current byte array.
`protected boolean` | `m_fDestructive` True iff the array will be null'd out as it is traversed.
`protected boolean` | `m_fEOF` True after eof is determined.
`protected int` | `m_iArray` The index of the current byte array.
`protected int` | `m_iArrayMarked` The index of the marked byte array.
`protected int` | `m_of` The current offset in the current byte array.
`protected int` | `m_ofMarked` The marked offset in the marked byte array.
`protected static int` | `MARK_UNSET` Marker position indicating that stream is not marked.

Constructor Summary
`MultiByteArrayInputStream(byte[][] aab)` Construct a MultiByteArrayInputStream.
`MultiByteArrayInputStream(byte[][] aab, boolean fDestructive)` Construct a MultiByteArrayInputStream.

Method Summary
`int` | `available()` Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
`void` | `close()` Close the stream.
`void` | `mark(int readlimit)` Marks the current position in this input stream.
`boolean` | `markSupported()` Tests if this input stream supports the `mark` and `reset` methods.
`int` | `read()` Reads the next byte of data from the input stream.
`int` | `read(byte[] abDest, int ofDest, int cbDest)` Reads up to `len` bytes of data from the input stream into an array of bytes.
`void` | `reset()` Repositions this stream to the position at the time the `mark` method was last called on this input stream.
`long` | `skip(long n)` Skips over and discards `n` bytes of data from this input stream.

Methods inherited from class java.io.InputStream
`read`

Methods inherited from interface com.tangosol.io.InputStreaming
`read`

Field Detail

### EMPTY_BYTES

    protected static final byte[] EMPTY_BYTES

  Empty array of bytes.

### MARK_UNSET

    protected static final int MARK_UNSET

  Marker position indicating that stream is not marked.

  See Also:
    Constant Field Values

### m_fEOF

    protected boolean m_fEOF

  True after eof is determined.

### m_fDestructive

    protected boolean m_fDestructive

  True iff the array will be null'd out as it is traversed.

### m_aabArray

    protected byte[][] m_aabArray

  The array of byte arrays.

### m_iArray

    protected int m_iArray

  The index of the current byte array.

### m_ab

    protected byte[] m_ab

  The current byte array.

### m_of

    protected int m_of

  The current offset in the current byte array.

### m_iArrayMarked

    protected int m_iArrayMarked

  The index of the marked byte array.

### m_ofMarked

    protected int m_ofMarked

  The marked offset in the marked byte array.

Constructor Detail

### MultiByteArrayInputStream

    public MultiByteArrayInputStream(byte[][] aab)

  Construct a MultiByteArrayInputStream.

  Parameters:
    `aab` - a non-null array of byte arrays of data to stream, each byte array must be non-null and non-zero-length

### MultiByteArrayInputStream

    public MultiByteArrayInputStream(byte[][] aab,
                                     boolean fDestructive)

  Construct a MultiByteArrayInputStream.

  Parameters:
    `aab` - a non-null array of byte arrays of data to stream, each byte array must be non-null and non-zero-length
    `fDestructive` - if true the supplied array will be cleared as it is traversed, stream mark positions will be respected

Method Detail

### read

    public int read()
             throws java.io.IOException

  Reads the next byte of data from the 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 method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

  Specified by:
    `read` in interface `InputStreaming`
  Specified by:
    `read` in class `java.io.InputStream`
  Returns:
    the next byte of data, or `-1` if the end of the stream is reached.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### read

    public int read(byte[] abDest,
                    int ofDest,
                    int cbDest)
             throws java.io.IOException

  Reads up to `len` bytes of data from the input stream into an array of bytes. An attempt is made to read as many as `len` bytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer.

  Specified by:
    `read` in interface `InputStreaming`
  Overrides:
    `read` in class `java.io.InputStream`
  Parameters:
    `abDest` - the buffer into which the data is read
    `ofDest` - the start offset in array `b` at which the data is written
    `cbDest` - the maximum number of bytes to 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.
  Throws:
    `java.io.IOException` - if an I/O error occurs

### available

    public int available()

  Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or or another thread.

  Specified by:
    `available` in interface `InputStreaming`
  Overrides:
    `available` in class `java.io.InputStream`
  Returns:
    the number of bytes that can be read from this input stream without blocking.

### skip

    public long skip(long n)

  Skips over and discards `n` bytes of data from this input stream. The `skip` method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly `0`. This may result from any of a number of conditions; reaching end of file before `n` bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. If `n` is negative, no bytes are skipped.

  Specified by:
    `skip` in interface `InputStreaming`
  Overrides:
    `skip` in class `java.io.InputStream`
  Parameters:
    `n` - the number of bytes to be skipped
  Returns:
    the actual number of bytes skipped

### close

    public void close()

  Close the stream.

  Specified by:
    `close` in interface `InputStreaming`
  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.InputStream`

### mark

    public void mark(int readlimit)

  Marks the current position in this input stream. A subsequent call to the `reset` method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.

  Specified by:
    `mark` in interface `InputStreaming`
  Overrides:
    `mark` in class `java.io.InputStream`
  Parameters:
    `readlimit` - the maximum limit of bytes that can be read before the mark position becomes invalid

### reset

    public void reset()
               throws java.io.IOException

  Repositions this stream to the position at the time the `mark` method was last called on this input stream.

  Specified by:
    `reset` in interface `InputStreaming`
  Overrides:
    `reset` in class `java.io.InputStream`
  Throws:
    `java.io.IOException` - if the stream has not been marked

### markSupported

    public boolean markSupported()

  Tests if this input stream supports the `mark` and `reset` methods. The `markSupported` method of `InputStream` returns `false`.

  Specified by:
    `markSupported` in interface `InputStreaming`
  Overrides:
    `markSupported` in class `java.io.InputStream`
  Returns:
    `true` if this true type supports the mark and reset method; `false` otherwise

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.