/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. This is the * inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. This is the * inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. This is the * inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
private static void assertFailsToDecode( BaseEncoding encoding, String cannotDecode, @Nullable String expectedMessage) { assertFalse(encoding.canDecode(cannotDecode)); try { encoding.decode(cannotDecode); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { if (expectedMessage != null) { assertThat(expected).hasCauseThat().hasMessageThat().isEqualTo(expectedMessage); } } try { encoding.decodeChecked(cannotDecode); fail("Expected DecodingException"); } catch (DecodingException expected) { if (expectedMessage != null) { assertThat(expected).hasMessageThat().isEqualTo(expectedMessage); } } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. This is the * inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. * This is the inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
/** * Decodes the specified character sequence, and returns the resulting {@code byte[]}. This is the * inverse operation to {@link #encode(byte[])}. * * @throws IllegalArgumentException if the input is not a valid encoded string according to this * encoding. */ public final byte[] decode(CharSequence chars) { try { return decodeChecked(chars); } catch (DecodingException badInput) { throw new IllegalArgumentException(badInput); } }
private static void assertFailsToDecode( BaseEncoding encoding, String cannotDecode, @Nullable String expectedMessage) { assertFalse(encoding.canDecode(cannotDecode)); try { encoding.decode(cannotDecode); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { if (expectedMessage != null) { assertThat(expected.getCause()).hasMessage(expectedMessage); } } try { encoding.decodeChecked(cannotDecode); fail("Expected DecodingException"); } catch (DecodingException expected) { if (expectedMessage != null) { assertThat(expected).hasMessage(expectedMessage); } } }