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

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

Introduction

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

Prototype

@CheckReturnValue
public abstract BaseEncoding omitPadding();

Source Link

Document

Returns an encoding that behaves equivalently to this encoding, but omits any padding characters as specified by <a href="http://tools.ietf.org/html/rfc4648#section-3.2">RFC 4648 section 3.2</a>, Padding of Encoded Data.

Usage

From source file:com.lithium.flow.util.BaseEncodings.java

@Nonnull
public static BaseEncoding of(@Nonnull String name) {
    checkNotNull(name);//w  w w . ja va 2  s  .  c  o m

    Iterator<String> it = Splitter.on(".").split(name).iterator();
    BaseEncoding encoding = getEncoding(it.next());
    while (it.hasNext()) {
        String mod = it.next();
        switch (mod) {
        case "lowerCase":
            encoding = encoding.lowerCase();
            break;
        case "upperCase":
            encoding = encoding.upperCase();
            break;
        case "omitPadding":
            encoding = encoding.omitPadding();
            break;
        default:
            throw new RuntimeException("unknown modifier: " + mod);
        }
    }
    return encoding;
}