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.mortbay.io
Class ByteArrayBuffer

    java.lang.Object
      org.mortbay.io.AbstractBuffer
          org.mortbay.io.ByteArrayBuffer

All Implemented Interfaces:
  Cloneable, Buffer

Direct Known Subclasses:
  ByteArrayBuffer.CaseInsensitive

    public class ByteArrayBuffer

extends AbstractBuffer

Author:
  gregw

Nested Class Summary
`static class` | `ByteArrayBuffer.CaseInsensitive`

Nested classes/interfaces inherited from interface org.mortbay.io.Buffer
`Buffer.CaseInsensitve`

Field Summary

Fields inherited from class org.mortbay.io.AbstractBuffer
`__IMMUTABLE, __READONLY, __READWRITE, __VOLATILE, _access, _get, _hash, _put, _string, _volatile`

Fields inherited from interface org.mortbay.io.Buffer
`IMMUTABLE, NON_VOLATILE, READONLY, READWRITE, VOLATILE`

Constructor Summary
`ByteArrayBuffer(byte[] bytes)`
`ByteArrayBuffer(byte[] bytes, int index, int length)`
`ByteArrayBuffer(byte[] bytes, int index, int length, int access)`
`ByteArrayBuffer(byte[] bytes, int index, int length, int access, boolean isVolatile)`
`ByteArrayBuffer(int size)`
`ByteArrayBuffer(String value)`

Method Summary
`byte[]` | `array()` Get the underlying array, if one exists.
`int` | `capacity()` The capacity of the buffer.
`byte` | `get()` Get the byte at the current getIndex and increment it.
`byte` | `peek(int index)` Get the byte at a specific index in the buffer.
`int` | `peek(int index, byte[] b, int offset, int length)`
`void` | `poke(int index, byte b)` Put a specific byte to a specific getIndex.
`int` | `readFrom(InputStream in, int max)` Read the buffer's contents from the input stream
`void` | `wrap(byte[] b)` Wrap a byte array
`void` | `wrap(byte[] b, int off, int len)` Wrap a byte array.
`void` | `writeTo(OutputStream out)` Write the buffer's contents to the output stream

Methods inherited from class org.mortbay.io.AbstractBuffer
`asArray, asImmutableBuffer, asMutableBuffer, asNonVolatileBuffer, asReadOnlyBuffer, buffer, clear, compact, duplicate, equals, equalsIgnoreCase, get, get, getIndex, hasContent, hashCode, isImmutable, isReadOnly, isVolatile, length, mark, mark, markIndex, peek, peek, poke, poke, put, put, put, put, putIndex, reset, rewind, setGetIndex, setMarkIndex, setPutIndex, skip, slice, sliceFromMark, sliceFromMark, space, toDebugString, toDetailString, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ByteArrayBuffer

    public ByteArrayBuffer(byte[] bytes)

### ByteArrayBuffer

    public ByteArrayBuffer(byte[] bytes,
                           int index,
                           int length)

### ByteArrayBuffer

    public ByteArrayBuffer(byte[] bytes,
                           int index,
                           int length,
                           int access)

### ByteArrayBuffer

    public ByteArrayBuffer(byte[] bytes,
                           int index,
                           int length,
                           int access,
                           boolean isVolatile)

### ByteArrayBuffer

    public ByteArrayBuffer(int size)

### ByteArrayBuffer

    public ByteArrayBuffer(String value)

Method Detail

### array

    public byte[] array()

  Description copied from interface: `Buffer`
  Get the underlying array, if one exists.

  Returns:
    a `byte[]` backing this buffer or null if none exists.

### capacity

    public int capacity()

  Description copied from interface: `Buffer`
  The capacity of the buffer. This is the maximum putIndex that may be set.

  Returns:
    an `int` value

### get

    public byte get()

  Description copied from interface: `Buffer`
  Get the byte at the current getIndex and increment it.

  Specified by:
    `get` in interface `Buffer`
  Overrides:
    `get` in class `AbstractBuffer`
  Returns:
    The `byte` value from the current getIndex.

### peek

    public byte peek(int index)

  Description copied from interface: `Buffer`
  Get the byte at a specific index in the buffer.

  Parameters:
    `index` - an `int` value
  Returns:
    a `byte` value

### peek

    public int peek(int index,
                    byte[] b,
                    int offset,
                    int length)

  Parameters:
    `index` - an `int` value
    `b` - The byte array to peek into
    `offset` - The offset into the array to start peeking
    `length` - an `int` value
  Returns:
    The number of bytes actually peeked

### poke

    public void poke(int index,
                     byte b)

  Description copied from interface: `Buffer`
  Put a specific byte to a specific getIndex.

  Parameters:
    `index` - an `int` value
    `b` - a `byte` value

### wrap

    public void wrap(byte[] b,
                     int off,
                     int len)

  Wrap a byte array.

  Parameters:
    `b` -
    `off` -
    `len` -

### wrap

    public void wrap(byte[] b)

  Wrap a byte array

  Parameters:
    `b` -

### writeTo

    public void writeTo(OutputStream out)
                 throws IOException

  Description copied from interface: `Buffer`
  Write the buffer's contents to the output stream

  Specified by:
    `writeTo` in interface `Buffer`
  Overrides:
    `writeTo` in class `AbstractBuffer`
  Throws:
    `IOException`

### readFrom

    public int readFrom(InputStream in,
                        int max)
                 throws IOException

  Description copied from interface: `Buffer`
  Read the buffer's contents from the input stream

  Specified by:
    `readFrom` in interface `Buffer`
  Overrides:
    `readFrom` in class `AbstractBuffer`
  Parameters:
    `in` - input stream
    `max` - maximum number of bytes that may be read
  Returns:
    actual number of bytes read or -1 for EOF
  Throws:
    `IOException`

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 © 2007 Mort Bay Consulting. All Rights Reserved.