Example usage for com.liferay.portal.kernel.util ArrayUtil clone

List of usage examples for com.liferay.portal.kernel.util ArrayUtil clone

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ArrayUtil clone.

Prototype

public static <T> T[][] clone(T[][] array, int from, int to) 

Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.util.Atom.java

License:Open Source License

public void patchAtom() {
    for (int index = 4; index < _size - 4; index++) {
        String type = new String(ArrayUtil.clone(_buffer, index, index + 4));

        if (type.equalsIgnoreCase(Atom.STCO)) {
            index += patchStcoAtom(index) - 4;
        } else if (type.equalsIgnoreCase(Atom.CO64)) {
            index += patchCo64Atom(index) - 4;
        }/*w  w  w. j  a v  a 2  s.  c  o m*/
    }
}

From source file:com.liferay.portlet.documentlibrary.util.Atom.java

License:Open Source License

protected boolean hasCompressedMoovAtom() {
    String type = new String(ArrayUtil.clone(_buffer, 12, 15));

    if (type.equalsIgnoreCase(Atom.CMOV)) {
        return true;
    } else {//from  w w w. j ava 2  s.  com
        return false;
    }
}

From source file:com.liferay.portlet.documentlibrary.util.Atom.java

License:Open Source License

protected int patchCo64Atom(int index) {
    int size = (int) bytesToLong(ArrayUtil.clone(_buffer, index - 4, index));

    int offsetCount = (int) bytesToLong(ArrayUtil.clone(_buffer, index + 8, index + 12));

    for (int i = 0; i < offsetCount; i++) {
        int offsetIndex = index + 12 + i * 8;

        long offset = bytesToLong(ArrayUtil.clone(_buffer, offsetIndex, offsetIndex + 8));

        offset += _size;/*from   w w w.j  a v  a  2s.c  o  m*/

        _buffer[offsetIndex + 0] = (byte) ((offset >> 56) & 0xFF);
        _buffer[offsetIndex + 1] = (byte) ((offset >> 48) & 0xFF);
        _buffer[offsetIndex + 2] = (byte) ((offset >> 40) & 0xFF);
        _buffer[offsetIndex + 3] = (byte) ((offset >> 32) & 0xFF);
        _buffer[offsetIndex + 4] = (byte) ((offset >> 24) & 0xFF);
        _buffer[offsetIndex + 5] = (byte) ((offset >> 16) & 0xFF);
        _buffer[offsetIndex + 6] = (byte) ((offset >> 8) & 0xFF);
        _buffer[offsetIndex + 7] = (byte) ((offset >> 0) & 0xFF);
    }

    return size;
}

From source file:com.liferay.portlet.documentlibrary.util.Atom.java

License:Open Source License

protected int patchStcoAtom(int index) {
    int size = (int) bytesToLong(ArrayUtil.clone(_buffer, index - 4, index));

    int offsetCount = (int) bytesToLong(ArrayUtil.clone(_buffer, index + 8, index + 12));

    for (int i = 0; i < offsetCount; i++) {
        int offsetIndex = index + 12 + i * 4;

        int offset = (int) bytesToLong(ArrayUtil.clone(_buffer, offsetIndex, offsetIndex + 4));

        offset += _size;//  ww w.j a va2  s  . c  o  m

        _buffer[offsetIndex + 0] = (byte) ((offset >> 24) & 0xFF);
        _buffer[offsetIndex + 1] = (byte) ((offset >> 16) & 0xFF);
        _buffer[offsetIndex + 2] = (byte) ((offset >> 8) & 0xFF);
        _buffer[offsetIndex + 3] = (byte) ((offset >> 0) & 0xFF);
    }

    return size;
}