Code example for ShortBufferException

0
 
        // BEGIN android-added 
        int outputLen = cipher.getOutputSize(inputLen);
 
        if (outputLen + outputOffset > output.length) {
            throw new ShortBufferException("need at least " + outputLen + " bytes");
        } 
        // BEGIN android-added 
 
        if (inputLen != 0)
        { 
                len = cipher.processBytes(input, inputOffset, inputLen, output, outputOffset);
        } 
 
        try 
        { 
            return (len + cipher.doFinal(output, outputOffset + len));
        } 
        catch (DataLengthException e)
        { 
            throw new IllegalBlockSizeException(e.getMessage());