/** Parses a value from a base64-encoded String using the given coder. */ public static <T> T decodeFromBase64(Coder<T> coder, String encodedValue) throws CoderException { return decodeFromSafeStream( coder, new ByteArrayInputStream(BaseEncoding.base64Url().omitPadding().decode(encodedValue)), Coder.Context.OUTER); }
public static <T> T decodeFromByteArray( Coder<T> coder, byte[] encodedValue, Coder.Context context) throws CoderException { try (ExposedByteArrayInputStream stream = new ExposedByteArrayInputStream(encodedValue)) { T result = decodeFromSafeStream(coder, stream, context); if (stream.available() != 0) { throw new CoderException( stream.available() + " unexpected extra bytes after decoding " + result); } return result; } }