
org.opentripplanner.framework.token.Deserializer Maven / Gradle / Ivy
The newest version!
package org.opentripplanner.framework.token;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Stream;
class Deserializer {
private static final Pattern SPLIT_PATTERN = Pattern.compile(
"[" + TokenFormatterConfiguration.fieldSeparator() + "]"
);
private final List values;
Deserializer(String token) {
byte[] bytes = Base64.getUrlDecoder().decode(token);
var tokenFormatter = TokenFormatterConfiguration.tokenFormatter();
this.values = Stream.of(SPLIT_PATTERN.split(new String(bytes), -1))
.map(tokenFormatter::decode)
.toList();
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy