com.healthmarketscience.jackcess.impl
Class ByteArrayBuilder

java.lang.Object
  extended by com.healthmarketscience.jackcess.impl.ByteArrayBuilder

public class ByteArrayBuilder
extends Object

Utility class for constructing byte[]s where the final size of the data is not known beforehand. The API is similar to ByteBuffer but the data is not actually written to a byte[] until toBuffer() or toArray() is called.

Author:
James Ahlborn

Constructor Summary
ByteArrayBuilder()
           
 
Method Summary
 int position()
           
 ByteArrayBuilder put(byte val)
           
 ByteArrayBuilder put(byte[] val)
           
 ByteArrayBuilder put(ByteBuffer val)
           
 ByteArrayBuilder putInt(int val)
           
 ByteArrayBuilder putInt(int pos, int val)
           
 ByteArrayBuilder putShort(int pos, short val)
           
 ByteArrayBuilder putShort(short val)
           
 ByteArrayBuilder reserve(int bytes)
           
 ByteArrayBuilder reserveInt()
           
 ByteArrayBuilder reserveShort()
           
 byte[] toArray()
           
 ByteBuffer toBuffer()
           
 ByteBuffer toBuffer(ByteBuffer buf)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayBuilder

public ByteArrayBuilder()
Method Detail

position

public int position()

reserveInt

public ByteArrayBuilder reserveInt()

reserveShort

public ByteArrayBuilder reserveShort()

reserve

public ByteArrayBuilder reserve(int bytes)

put

public ByteArrayBuilder put(byte val)

putInt

public ByteArrayBuilder putInt(int val)

putInt

public ByteArrayBuilder putInt(int pos,
                               int val)

putShort

public ByteArrayBuilder putShort(short val)

putShort

public ByteArrayBuilder putShort(int pos,
                                 short val)

put

public ByteArrayBuilder put(byte[] val)

put

public ByteArrayBuilder put(ByteBuffer val)

toBuffer

public ByteBuffer toBuffer()

toBuffer

public ByteBuffer toBuffer(ByteBuffer buf)

toArray

public byte[] toArray()


Copyright © 2005–2017 Health Market Science. All rights reserved.