com.devexperts.qd.util
Class ByteArrayBuffer

java.lang.Object
  extended by com.devexperts.qd.util.ByteArrayBuffer
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ByteArrayDataInput, ByteArrayDataOutput

Deprecated. No replacement

public class ByteArrayBuffer
extends java.lang.Object
implements java.io.Serializable

The ByteArrayBuffer is a linear byte buffer designed for stream implementations. Aside from its content, the essential properties of a buffer are its position and limit.

A buffer's position is the index of the next byte to be read or written. A buffer's position is never negative and is never greater than its limit. A buffer's position changes as individual bytes are being read or written.

A buffer's limit is the index of the first byte that should not be read or written. A buffer's limit is never negative and is never greater than its current capacity. A buffer's limit changes as required or as external bulk operations command.

See Also:
Serialized Form

Field Summary
protected  byte[] buffer
          Deprecated.  
protected  int limit
          Deprecated.  
protected  int position
          Deprecated.  
 
Constructor Summary
ByteArrayBuffer()
          Deprecated.  
 
Method Summary
 void clear()
          Deprecated. Clears this buffer.
 void copy(int source_position, int dest_position, int length)
          Deprecated. Copies a region of bytes in the buffer.
 void ensureCapacity(int required_capacity)
          Deprecated. Ensures that the byte array has at least the specified capacity.
 void expandLimit(int required_limit)
          Deprecated. Expands byte array to the specified limit (or more).
 byte[] getBuffer()
          Deprecated. Returns the byte array that backs this buffer.
 int getLimit()
          Deprecated. Returns this buffer's limit.
 int getPosition()
          Deprecated. Returns this buffer's position.
 void setBuffer(byte[] new_buffer)
          Deprecated. Sets specified byte array to be used for buffering.
 void setLimit(int new_limit)
          Deprecated. Sets this buffer's limit.
 void setPosition(int new_position)
          Deprecated. Sets this buffer's position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected byte[] buffer
Deprecated. 

position

protected int position
Deprecated. 

limit

protected int limit
Deprecated. 
Constructor Detail

ByteArrayBuffer

public ByteArrayBuffer()
Deprecated. 
Method Detail

getBuffer

public byte[] getBuffer()
Deprecated. 
Returns the byte array that backs this buffer. May return null.


setBuffer

public void setBuffer(byte[] new_buffer)
Deprecated. 
Sets specified byte array to be used for buffering. Accepts null. The position is set to zero, the limit is set to the capacity of new buffer.


getPosition

public int getPosition()
Deprecated. 
Returns this buffer's position.


setPosition

public void setPosition(int new_position)
Deprecated. 
Sets this buffer's position.

Throws:
java.lang.IllegalArgumentException - if the new position is negative or is larger than the current limit.

getLimit

public int getLimit()
Deprecated. 
Returns this buffer's limit.


setLimit

public void setLimit(int new_limit)
Deprecated. 
Sets this buffer's limit. If the position is larger than the new limit then it is set to the new limit.

Throws:
java.lang.IllegalArgumentException - if the new limit is negative or is larger than the current capacity.

ensureCapacity

public void ensureCapacity(int required_capacity)
Deprecated. 
Ensures that the byte array has at least the specified capacity. By default, this method reallocates byte array if needed and copies content of old array into new one.


clear

public void clear()
Deprecated. 
Clears this buffer. The position is set to zero, the limit is set to the current capacity.


copy

public void copy(int source_position,
                 int dest_position,
                 int length)
Deprecated. 
Copies a region of bytes in the buffer. The position and limit remain unaffected.

Throws:
java.lang.IndexOutOfBoundsException - if copying would cause access of data outside current buffer array bounds.

expandLimit

public void expandLimit(int required_limit)
                 throws java.io.IOException
Deprecated. 
Expands byte array to the specified limit (or more). By default, this method reallocates byte array if needed and copies content of old array into new one.

This method shall be used internally when position reaches limit. This method may be overriden to change memory management behavior.

Throws:
java.io.IOException - if an I/O error occurs (expansion impossible).