Java Code Examples for sun.security.jca.JCAUtil#getTempArraySize()

The following examples show how to use sun.security.jca.JCAUtil#getTempArraySize() . 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: MessageDigestSpi.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 2
Source File: MessageDigestSpi.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 3
Source File: MessageDigestSpi.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 4
Source File: MessageDigestSpi.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the <code>input.remaining()</code> bytes starting
 * at <code>input.position()</code>.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 5
Source File: MessageDigestSpi.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 6
Source File: MessageDigestSpi.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 7
Source File: MessageDigestSpi.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 8
Source File: MessageDigestSpi.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 9
Source File: MessageDigestSpi.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 10
Source File: MessageDigestSpi.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 11
Source File: MessageDigestSpi.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 12
Source File: MessageDigestSpi.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 13
Source File: MessageDigestSpi.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 14
Source File: MessageDigestSpi.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 15
Source File: MessageDigestSpi.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 16
Source File: MessageDigestSpi.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 17
Source File: MessageDigestSpi.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 18
Source File: MessageDigestSpi.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}
 
Example 19
Source File: MessageDigestSpi.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Update the digest using the specified ByteBuffer. The digest is
 * updated using the {@code input.remaining()} bytes starting
 * at {@code input.position()}.
 * Upon return, the buffer's position will be equal to its limit;
 * its limit will not have changed.
 *
 * @param input the ByteBuffer
 * @since 1.5
 */
protected void engineUpdate(ByteBuffer input) {
    if (input.hasRemaining() == false) {
        return;
    }
    if (input.hasArray()) {
        byte[] b = input.array();
        int ofs = input.arrayOffset();
        int pos = input.position();
        int lim = input.limit();
        engineUpdate(b, ofs + pos, lim - pos);
        input.position(lim);
    } else {
        int len = input.remaining();
        int n = JCAUtil.getTempArraySize(len);
        if ((tempArray == null) || (n > tempArray.length)) {
            tempArray = new byte[n];
        }
        while (len > 0) {
            int chunk = Math.min(len, tempArray.length);
            input.get(tempArray, 0, chunk);
            engineUpdate(tempArray, 0, chunk);
            len -= chunk;
        }
    }
}