class ByteArray implements Serializable, Cloneable {

    public ByteArray slice(int displacement, int length) {
        value.position(displacement).limit(displacement + length);
        ByteArray newByteArray = new ByteArray(value.slice(), encoding);
        // Order is not propagated on a ByteBuffer slice, so we need to
        // explicitly set it.
        newByteArray.setOrder(this.getOrder());
        // reset limit to capacity.
        value.clear();
        return newByteArray;
    }

    public  ByteArray(int size);
    public  ByteArray(int size, String encoding);
    public  ByteArray(int size, ByteOrder order);
    public  ByteArray(int size, String encoding, ByteOrder order);
    public  ByteArray(byte[] array);
    public  ByteArray(byte[] array, ByteOrder order);
    public  ByteArray(byte[] array, String encoding);
    public  ByteArray(byte[] array, String encoding, ByteOrder order);
    public  ByteArray(ByteArray byteArray);
    public  ByteArray(ByteBuffer buffer);
    public  ByteArray(ByteBuffer buffer, String encoding);

}