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 ByteArrayReadBuffer

    java.lang.Object
      com.tangosol.util.Base
          com.tangosol.io.AbstractReadBuffer
              com.tangosol.io.AbstractByteArrayReadBuffer
                  com.tangosol.io.ByteArrayReadBuffer

All Implemented Interfaces:
  ReadBuffer, java.lang.Cloneable

    public class ByteArrayReadBuffer

extends AbstractByteArrayReadBuffer

A ReadBuffer on top of a byte array.

Author:
  cp 2005.01.20

Nested Class Summary

Nested classes/interfaces inherited from class com.tangosol.io.AbstractByteArrayReadBuffer
`AbstractByteArrayReadBuffer.ByteArrayBufferInput`

Nested classes/interfaces inherited from class com.tangosol.io.AbstractReadBuffer
`AbstractReadBuffer.AbstractBufferInput`

Nested classes/interfaces inherited from interface com.tangosol.io.ReadBuffer
`ReadBuffer.BufferInput`

Field Summary

Fields inherited from class com.tangosol.io.AbstractByteArrayReadBuffer
`m_ab, m_cb, m_of`

Fields inherited from class com.tangosol.io.AbstractReadBuffer
`NO_BINARY, NO_BYTES`

Constructor Summary
`protected` | `ByteArrayReadBuffer()` Default constructor provided for subclasses.
`` | `ByteArrayReadBuffer(byte[] ab)` Construct a ByteArrayReadBuffer object from a byte array.
`` | `ByteArrayReadBuffer(byte[] ab, int of, int cb)` Construct a ByteArrayReadBuffer object from a portion of a byte array.
`` | `ByteArrayReadBuffer(byte[] ab, int of, int cb, boolean fCopy, boolean fPrivate, boolean fShallowClone)` Construct a ByteArrayReadBuffer object from a portion of a byte array.

Method Summary
`java.lang.Object` | `clone()` Create a clone of this ByteArrayReadBuffer object.
`byte[]` | `getRawByteArray()` Obtain the byte array that this ReadBuffer uses.
`int` | `getRawOffset()` Determine the offset into the byte array returned from `getRawByteArray()` that this ReadBuffer uses.
`protected ReadBuffer` | `instantiateReadBuffer(int of, int cb)` Factory method: Instantiate a ReadBuffer for a portion of this ReadBuffer.
`protected boolean` | `isByteArrayPrivate()` Determine if the underlying byte[] should be treated as private data.
`protected boolean` | `isShallowCloneable()` Determine whether a clone can be made without cloning the byte array.
`void` | `resetRange(int of, int cb)` Reset the portion of the byte array the ReadBuffer operates upon.
`java.lang.String` | `toString()` Provide a human-readable representation of the Binary object.

Methods inherited from class com.tangosol.io.AbstractByteArrayReadBuffer
`byteAt, copyBytes, instantiateBufferInput, length, toBinary, toBinary, toByteArray`

Methods inherited from class com.tangosol.io.AbstractReadBuffer
`checkBounds, equals, getBufferInput, getReadBuffer, toByteArray`

Constructor Detail

### ByteArrayReadBuffer

    protected ByteArrayReadBuffer()

  Default constructor provided for subclasses.

### ByteArrayReadBuffer

    public ByteArrayReadBuffer(byte[] ab)

  Construct a ByteArrayReadBuffer object from a byte array. This constructor does not copy the byte array or make it private.

  Parameters:
    `ab` - an array of bytes

### ByteArrayReadBuffer

    public ByteArrayReadBuffer(byte[] ab,
                               int of,
                               int cb)

  Construct a ByteArrayReadBuffer object from a portion of a byte array. This constructor does not copy the byte array or make it private.

  Parameters:
    `ab` - an array of bytes
    `of` - the offset into the byte array
    `cb` - the number of bytes to extract

### ByteArrayReadBuffer

    public ByteArrayReadBuffer(byte[] ab,
                               int of,
                               int cb,
                               boolean fCopy,
                               boolean fPrivate,
                               boolean fShallowClone)

  Construct a ByteArrayReadBuffer object from a portion of a byte array.

  Parameters:
    `ab` - an array of bytes
    `of` - the offset into the byte array
    `cb` - the number of bytes to extract
    `fCopy` - true to make a copy of the passed array
    `fPrivate` - true to treat the passed array as private data
    `fShallowClone` - true to allow cloning without copying the underlying byte[]

Method Detail

### resetRange

    public void resetRange(int of,
                           int cb)

  Reset the portion of the byte array the ReadBuffer operates upon.

  Overrides:
    `resetRange` in class `AbstractByteArrayReadBuffer`
  Parameters:
    `of` - an offset into the byte array
    `cb` - the number of bytes to utilize

### getRawByteArray

    public byte[] getRawByteArray()

  Obtain the byte array that this ReadBuffer uses. If the underlying byte array is private, then this method will always return a copy of the portion of the byte array that this ReadBuffer represents as if the called had called `AbstractReadBuffer.toByteArray()`.

  Returns:
    the byte array that this ReadBuffer uses

### getRawOffset

    public int getRawOffset()

  Determine the offset into the byte array returned from `getRawByteArray()` that this ReadBuffer uses. If the underlying byte array is private, then this method will always return zero because `getRawByteArray()` will always return a copy of the portion of the byte array that this ReadBuffer represents.

  Returns:
    the offset into the raw byte array that this ReadBuffer uses

### instantiateReadBuffer

    protected ReadBuffer instantiateReadBuffer(int of,
                                               int cb)

  Factory method: Instantiate a ReadBuffer for a portion of this ReadBuffer.

  Specified by:
    `instantiateReadBuffer` in class `AbstractReadBuffer`
  Parameters:
    `of` - the beginning index, inclusive
    `cb` - the number of bytes to include in the resulting ReadBuffer
  Returns:
    a ReadBuffer that represents a portion of this ReadBuffer

### clone

    public java.lang.Object clone()

  Create a clone of this ByteArrayReadBuffer object.

  Specified by:
    `clone` in interface `ReadBuffer`
  Overrides:
    `clone` in class `AbstractReadBuffer`
  Returns:
    a ByteArrayReadBuffer object with the same contents as this ByteArrayReadBuffer object

### toString

    public java.lang.String toString()

  Provide a human-readable representation of the Binary object.

  Returns:
    a String whose contents represent the value of this Binary object

### isByteArrayPrivate

    protected boolean isByteArrayPrivate()

  Determine if the underlying byte[] should be treated as private data.

  Specified by:
    `isByteArrayPrivate` in class `AbstractByteArrayReadBuffer`
  Returns:
    true iff the underlying data should not ever be exposed by this object

### isShallowCloneable

    protected boolean isShallowCloneable()

  Determine whether a clone can be made without cloning the byte array.

  Returns:
    true iff the underlying data can be shared by multiple instances of the ByteArrayReadBuffer class

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.