Example usage for java.lang Character MAX_RADIX

List of usage examples for java.lang Character MAX_RADIX

Introduction

In this page you can find the example usage for java.lang Character MAX_RADIX.

Prototype

int MAX_RADIX

To view the source code for java.lang Character MAX_RADIX.

Click Source Link

Document

The maximum radix available for conversion to and from strings.

Usage

From source file:lucee.runtime.config.ConfigWebImpl.java

public Mapping getApplicationMapping(String type, String virtual, String physical, String archive,
        boolean physicalFirst, boolean ignoreVirtual) {
    String key = type + ":" + virtual.toLowerCase() + ":" + (physical == null ? "" : physical.toLowerCase())
            + ":" + (archive == null ? "" : archive.toLowerCase()) + ":" + physicalFirst;
    key = Long.toString(HashUtil.create64BitHash(key), Character.MAX_RADIX);

    Mapping m = applicationMappings.get(key);

    if (m == null) {
        m = new MappingImpl(this, virtual, physical, archive, ConfigImpl.INSPECT_UNDEFINED, physicalFirst,
                false, false, false, true, ignoreVirtual, null);
        applicationMappings.put(key, m);
    }//w  w  w .  j av a  2s  .  c o m

    return m;
}

From source file:org.apache.blur.command.BaseCommandManager.java

protected void loadNewCommand(FileSystem fileSystem, FileStatus fileStatus, BigInteger hashOfContents)
        throws IOException {
    File file = new File(_tmpPath, UUID.randomUUID().toString());
    if (!file.mkdirs()) {
        LOG.error("Error while trying to create a tmp directory for loading a new command set from [{0}].",
                fileStatus.getPath());//from  w  ww .  j  a va2s.c om
        return;
    }
    LOG.info("Copying new command with hash [{2}] set from [{0}] into [{1}].", fileStatus.getPath(),
            file.getAbsolutePath(), hashOfContents.toString(Character.MAX_RADIX));
    copyLocal(fileSystem, fileStatus, file);
    URLClassLoader loader = new URLClassLoader(getUrls(file).toArray(new URL[] {}));
    Enumeration<URL> resources = loader.getResources(META_INF_SERVICES_ORG_APACHE_BLUR_COMMAND_COMMANDS);
    loadCommandClasses(resources, loader, hashOfContents);
}

From source file:at.irian.myfaces.wscope.renderkit.html.WsServerSideStateCacheImpl.java

protected Integer getServerStateId(Object[] state) {
    if (state != null) {
        Object serverStateId = state[JSF_SEQUENCE_INDEX];
        if (serverStateId != null) {
            return Integer.valueOf((String) serverStateId, Character.MAX_RADIX);
        }//ww w . j  a  v  a2  s .  c o  m
    }
    return null;
}

From source file:org.apache.james.mailrepository.file.MBoxMailRepository.java

/**
 * Generate a hex representation of an MD5 checksum on the emailbody
 * //from ww w . j a va2s. c  o m
 * @param emailBody
 * @return A hex representation of the text
 * @throws NoSuchAlgorithmException
 */
private String generateKeyValue(String emailBody) throws NoSuchAlgorithmException {
    // MD5 the email body for a reilable (ha ha) key
    byte[] digArray = MessageDigest.getInstance("MD5").digest(emailBody.getBytes());
    StringBuilder digest = new StringBuilder();
    for (byte aDigArray : digArray) {
        digest.append(Integer.toString(aDigArray, Character.MAX_RADIX).toUpperCase(Locale.US));
    }
    return digest.toString();
}

From source file:nl.b3p.kaartenbalie.core.server.persistence.MyEMFDatabase.java

/** Returns a unique name created with given parameters.
 *
 * @param prefix String containing the prefix.
 * @param extension String containing the extension.
 * @param includePath boolean setting the including of the path to true or false.
 *
 * @return a String representing a unique name for these parameters.
 *//*  w ww. ja v a  2 s .c  om*/
public static String uniqueName(String prefix, String extension, boolean includePath) {
    // Gebruik tijd in milliseconden om gerekend naar een radix van 36.
    // Hierdoor ontstaat een lekker korte code.
    long now = (new Date()).getTime();
    String val1 = Long.toString(now, Character.MAX_RADIX).toUpperCase();
    // random nummer er aanplakken om zeker te zijn van unieke code
    if (rg == null) {
        rg = new Random();
    }
    long rnum = (long) rg.nextInt(1000);
    String val2 = Long.toString(rnum, Character.MAX_RADIX).toUpperCase();
    String thePath = "";
    if (includePath) {
        thePath = cachePath;
    }
    if (prefix == null) {
        prefix = "";
    }
    if (extension == null) {
        extension = "";
    }
    return thePath + prefix + val1 + val2 + extension;
}

From source file:com.jungle.base.utils.MiscUtils.java

public static String getHash(byte[] value) {
    try {//from www . j a  va 2  s  . co m
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        md5.update(value);
        BigInteger bi = new BigInteger(md5.digest()).abs();
        return bi.toString(Character.MAX_RADIX);
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    }

    return serializationBytesToHex(value);
}

From source file:org.apache.blur.command.BaseCommandManager.java

protected BigInteger checkContents(FileStatus fileStatus, FileSystem fileSystem) throws IOException {
    if (fileStatus.isDir()) {
        LOG.debug("Scanning directory [{0}].", fileStatus.getPath());
        BigInteger count = BigInteger.ZERO;
        Path path = fileStatus.getPath();
        FileStatus[] listStatus = fileSystem.listStatus(path);
        for (FileStatus fs : listStatus) {
            count = count.add(checkContents(fs, fileSystem));
        }/*www .jav a  2s  .c  o  m*/
        return count;
    } else {
        int hashCode = fileStatus.getPath().toString().hashCode();
        long modificationTime = fileStatus.getModificationTime();
        long len = fileStatus.getLen();
        BigInteger bi = BigInteger.valueOf(hashCode)
                .add(BigInteger.valueOf(modificationTime).add(BigInteger.valueOf(len)));
        LOG.debug("File path hashcode [{0}], mod time [{1}], len [{2}] equals file code [{3}].",
                Integer.toString(hashCode), Long.toString(modificationTime), Long.toString(len),
                bi.toString(Character.MAX_RADIX));
        return bi;
    }
}

From source file:cltestgrid.Upload2.java

private static String generateId() {
    final int ID_LEN = 10;

    long l = Math.abs(random.nextLong());
    String str = Long.toString(l, Character.MAX_RADIX);
    if (str.length() > ID_LEN) {
        return str.substring(0, ID_LEN);
    }//from   w w  w .j  ava 2 s .com
    if (str.length() < ID_LEN) {
        StringBuilder padding = new StringBuilder(ID_LEN - str.length());
        for (int i = str.length(); i < ID_LEN; i++) {
            padding.append('0');
        }
        return padding.toString() + str;
    }
    return str;
}

From source file:org.callimachusproject.auth.CookieAuthenticationManager.java

private String nextNonce() {
    synchronized (random) {
        return Long.toString(Math.abs(random.nextLong()), Character.MAX_RADIX);
    }
}

From source file:org.callimachusproject.auth.DigestAuthenticationManager.java

private String nextNonce(Object resource, String[] via) {
    String ip = hash(via);/*  w  w w  .  ja v  a2s .  com*/
    String revision = getRevisionOf(resource);
    long now = System.currentTimeMillis();
    String time = Long.toString(now, Character.MAX_RADIX);
    return time + ":" + revision + ":" + ip;
}