i2p.susi.util

## Class ReadBuffer

- java.lang.Object
- - i2p.susi.util.ReadBuffer

- All Implemented Interfaces:
    Buffer

      public class ReadBuffer
      extends Object
      implements Buffer

  Read-only Buffer for constant data initialized from a byte array. See MemoryBuffer for read/write support.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `byte[]` | `content`
    `int` | `length`
    `int` | `offset`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReadBuffer(byte[] content, int offset, int length)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `InputStream` | `getInputStream()`
    `int` | `getLength()` Always valid
    `int` | `getOffset()` Always valid
    `OutputStream` | `getOutputStream()`
    `void` | `readComplete(boolean success)` Does nothing
    `String` | `toString()`
    `void` | `writeComplete(boolean success)` Does nothing

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### content

          public final byte[] content

    - #### length

          public final int length

    - #### offset

          public final int offset

  - ### Constructor Detail

    - #### ReadBuffer

          public ReadBuffer(byte[] content,
                            int offset,
                            int length)

  - ### Method Detail

    - #### getInputStream

          public InputStream getInputStream()

      Specified by:
        `getInputStream` in interface `Buffer`
      Returns:
        new ByteArrayInputStream over the content

    - #### getLength

          public int getLength()

      Always valid
      Specified by:
        `getLength` in interface `Buffer`

    - #### getOffset

          public int getOffset()

      Always valid
      Specified by:
        `getOffset` in interface `Buffer`

    - #### getOutputStream

          public OutputStream getOutputStream()

      Specified by:
        `getOutputStream` in interface `Buffer`
      Throws:
        `IllegalStateException` - always

    - #### readComplete

          public void readComplete(boolean success)

      Does nothing
      Specified by:
        `readComplete` in interface `Buffer`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### writeComplete

          public void writeComplete(boolean success)

      Does nothing
      Specified by:
        `writeComplete` in interface `Buffer`
      Parameters:
        `success` - if false, deletes any resources