Example usage for com.google.common.io BaseEncoding base64Url

List of usage examples for com.google.common.io BaseEncoding base64Url

Introduction

In this page you can find the example usage for com.google.common.io BaseEncoding base64Url.

Prototype

public static BaseEncoding base64Url() 

Source Link

Document

The "base64url" encoding specified by <a href="http://tools.ietf.org/html/rfc4648#section-5">RFC 4648 section 5</a>, Base 64 Encoding with URL and Filename Safe Alphabet, also sometimes referred to as the "web safe Base64."

Usage

From source file:com.facebook.buck.features.apple.project.ProjectGenerator.java

private Path getFilenameToHeadersPath(TargetNode<? extends CxxLibraryDescription.CommonArg> targetNode,
        String suffix) {/*from   ww  w.  ja  v  a 2  s  .c o  m*/
    String hashedPath = BaseEncoding.base64Url().omitPadding()
            .encode(Hashing.sha1()
                    .hashString(targetNode.getBuildTarget().getUnflavoredBuildTarget().getFullyQualifiedName(),
                            Charsets.UTF_8)
                    .asBytes())
            .substring(0, 10);
    return Paths.get(hashedPath + suffix);
}