Java Code Examples for skadistats.clarity.decoder.Util#byteCopy()

The following examples show how to use skadistats.clarity.decoder.Util#byteCopy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NormalBitStream64.java    From clarity with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void readBitsIntoByteArray(byte[] dest, int n) {
    int nBytes = (n + 7) / 8;
    if ((pos & 7) == 0) {
        Util.byteCopy(data, pos >> 3, dest, 0, nBytes);
        pos += n;
        return;
    }
    int i = 0;
    while (n > 7) {
        dest[i++] = (byte) readUBitInt(8);
        n -= 8;
    }
    if (n != 0) {
        dest[i] = (byte) readUBitInt(n);
    }
}
 
Example 2
Source File: NormalBitStream32.java    From clarity with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void readBitsIntoByteArray(byte[] dest, int n) {
    int nBytes = (n + 7) / 8;
    if ((pos & 7) == 0) {
        Util.byteCopy(data, pos >> 3, dest, 0, nBytes);
        pos += n;
        return;
    }
    int i = 0;
    while (n > 7) {
        dest[i++] = (byte) readUBitInt(8);
        n -= 8;
    }
    if (n != 0) {
        dest[i] = (byte) readUBitInt(n);
    }
}
 
Example 3
Source File: NormalBitStream64.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected NormalBitStream64(ByteString input) {
    len = input.size();
    data = new long[(len + 15)  >> 3];
    pos = 0;
    Util.byteCopy(ZeroCopy.extract(input), 0, data, 0, len);
    len = len * 8; // from now on size in bits
}
 
Example 4
Source File: NormalBitStream32.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected NormalBitStream32(ByteString input) {
    len = input.size();
    data = new int[(len + 7)  >> 2];
    pos = 0;
    Util.byteCopy(ZeroCopy.extract(input), 0, data, 0, len);
    len = len * 8; // from now on size in bits
}