@Test public void parsesWildcardCharacterEncodings() throws Exception { CharacterEncoding result = CharacterEncodings.fromString("*"); assertThat(result,notNullValue()); assertThat(result.isWildcard(),equalTo(true)); }
public static CharacterEncoding fromString(final String name) { requireNonNull(name,"Character encoding name cannot be null"); try { if(WILDCARD.equals(name)) { return wildcard(); } else { return of(Charset.forName(name)); } } catch (final UnsupportedCharsetException ex) { throw new IllegalArgumentException("Unsupported character encoding '"+ex.getCharsetName()+"'",ex); } catch (final IllegalCharsetNameException ex) { throw new IllegalArgumentException("Invalid character encoding name '"+ex.getCharsetName()+"'",ex); } }
CharacterEncodings { public static CharacterEncoding fromString(final String name) { requireNonNull(name,"Character encoding name cannot be null"); try { if(WILDCARD.equals(name)) { return wildcard(); } else { return of(Charset.forName(name)); } } catch (final UnsupportedCharsetException ex) { throw new IllegalArgumentException("Unsupported character encoding '"+ex.getCharsetName()+"'",ex); } catch (final IllegalCharsetNameException ex) { throw new IllegalArgumentException("Invalid character encoding name '"+ex.getCharsetName()+"'",ex); } } }
CharacterEncodings { public static CharacterEncoding fromString(final String name) { requireNonNull(name,"Character encoding name cannot be null"); try { if(WILDCARD.equals(name)) { return wildcard(); } else { return of(Charset.forName(name)); } } catch (final UnsupportedCharsetException ex) { throw new IllegalArgumentException("Unsupported character encoding '"+ex.getCharsetName()+"'",ex); } catch (final IllegalCharsetNameException ex) { throw new IllegalArgumentException("Invalid character encoding name '"+ex.getCharsetName()+"'",ex); } } private  CharacterEncodings(); }
CharacterEncodings { public static CharacterEncoding fromString(final String name) { requireNonNull(name,"Character encoding name cannot be null"); try { if(WILDCARD.equals(name)) { return wildcard(); } else { return of(Charset.forName(name)); } } catch (final UnsupportedCharsetException ex) { throw new IllegalArgumentException("Unsupported character encoding '"+ex.getCharsetName()+"'",ex); } catch (final IllegalCharsetNameException ex) { throw new IllegalArgumentException("Invalid character encoding name '"+ex.getCharsetName()+"'",ex); } } private  CharacterEncodings(); static CharacterEncoding wildcard(); static CharacterEncoding of(Charset charset); static CharacterEncoding fromString(final String name); static boolean includes(CharacterEncoding ce1, CharacterEncoding ce2); }
CharacterEncodings { public static CharacterEncoding fromString(final String name) { requireNonNull(name,"Character encoding name cannot be null"); try { if(WILDCARD.equals(name)) { return wildcard(); } else { return of(Charset.forName(name)); } } catch (final UnsupportedCharsetException ex) { throw new IllegalArgumentException("Unsupported character encoding '"+ex.getCharsetName()+"'",ex); } catch (final IllegalCharsetNameException ex) { throw new IllegalArgumentException("Invalid character encoding name '"+ex.getCharsetName()+"'",ex); } } private  CharacterEncodings(); static CharacterEncoding wildcard(); static CharacterEncoding of(Charset charset); static CharacterEncoding fromString(final String name); static boolean includes(CharacterEncoding ce1, CharacterEncoding ce2);  }