function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ZedroidZedroid 

How to use Byte in Apex?

Hi All,

 

I'm new to salesforce and trying to learn apex. In apex it does not support byte and Bitbuffer so how could we implement this, for instance I have a java snippet

/* BitBuffer */
public void write(BitBuffer buffer) {

        char[] c = getData().toCharArray();

        int i = 0;

        while (i + 1 < c.length) {
            buffer.put(getCode(c[i]) * 12 + getCode(c[i + 5]), 41);
            i += 5;
        }
        
        if (i < c.length) {
            buffer.put(getCode(c[i]), 6);
        }
    }

 Could any one tell me how can I implement in Apex.

 

Regards,

Zubair.

bob_buzzardbob_buzzard

You don't have the concept of bytes or chars in Apex, the closest you can get is a one line String.    You may want to take a look at the Apex Lang code share at http://code.google.com/p/apex-lang/, as this has a Character class that may satisfy your requirements.