@Override public boolean validateTestObject( Charset testObject, Object actual ) { if ( !( actual instanceof Charset ) ) { return false; } Charset another = (Charset) actual; return ( testObject.compareTo( another ) == 0 ); } }
return 1; comp = thisCharset.compareTo(otherCharset); if (comp != 0) { return comp;
return 1; comp = thisCharset.compareTo(otherCharset); if (comp != 0) { return comp;
/** * @see Charset#compareTo(Charset) * @since 2.6 */ public int compareTo(Charset that) { return charset.compareTo(that); }
public static void setSystemEncoding( final String encoding ) { Charset platformCharset = Charset.forName( encoding ); Charset defaultCharset = Charset.defaultCharset(); if ( platformCharset.compareTo( defaultCharset ) != 0 ) { Logger.warn( LocaleHelper.class.getName(), Messages.getInstance().getString( "LocaleHelper.WARN_CHARSETS_DONT_MATCH", platformCharset.name(), defaultCharset.name() ) ); } LocaleHelper.encoding = encoding; }
return 1; comp = thisCharset.compareTo(otherCharset); if (comp != 0) { return comp;
public InputStream getFakeInputStream(URL source) throws IOException { InputStream is = null; if (fakefile != null) { is = fakefile.getInputStream(); } if (faketext != null) { is = new ByteArrayInputStream(faketext.getBytes()); } if (is == null) { return null; } Charset c = getCharsetObjForURL(source); if (c == null) { UnicodeInputStream uis = new UnicodeInputStream(is); String guessedCharset = uis.getEncodingFromStream(); if (guessedCharset != null) { setCharsetForURL(source, guessedCharset); } return uis; } else { if (utf8Charset.compareTo(c) == 0) { return new UnicodeInputStream(is); } } return is; }
} catch (IOException ioex) { } else if (c.compareTo(originalCharset) != 0) { Exception ex = new Exception("Conflicting charset definition " + "between network and @charset " +
private int compareParametersStructurally(final MediaType mediaType1, final MediaType mediaType2) { final ParameterComparatorHelper h1=new ParameterComparatorHelper(mediaType1); final ParameterComparatorHelper h2=new ParameterComparatorHelper(mediaType2); final int paramNameComparison = h1.parameterNames().compareTo(h2.parameterNames()); if(paramNameComparison!=0) { return paramNameComparison; } final int paramValueComparison=h1.parameterValuesExceptCharset().compareTo(h2.parameterValuesExceptCharset()); if(paramValueComparison!=0) { return paramValueComparison; } if(!h1.hasCharset()) { return 0; } return mediaType1.charset().compareTo(mediaType2.charset()); }
@Override public int compare(CharacterEncoding o1, CharacterEncoding o2) { if(o1.isWildcard() && !o2.isWildcard()) { return 1; } else if(o2.isWildcard() && !o1.isWildcard()) { return -1; } else if(o1.charset()==o2.charset()) { return 0; } return o1.charset().compareTo(o2.charset()); }