Example usage for org.apache.wicket.util.crypt Base64 encodeBase64

List of usage examples for org.apache.wicket.util.crypt Base64 encodeBase64

Introduction

In this page you can find the example usage for org.apache.wicket.util.crypt Base64 encodeBase64.

Prototype

public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe) 

Source Link

Document

Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks.

Usage

From source file:sf.wicklet.ext.application.WickletSupport.java

License:Apache License

public static String randomString(final Random random, final int min, final int max) {
    final byte[] a = new byte[max];
    random.nextBytes(a);//w w w .j a  v a  2s.com
    int len = min;
    if (max != min) {
        len += random.nextInt(max - min + 1);
    }
    String ret = StringUtils.newStringUsAscii(Base64.encodeBase64(a, false, true));
    if (ret.length() != len) {
        ret = ret.substring(0, len);
    }
    return ret;
}