The javadocs say it can be an "expensive" operation. But considering the alternatives [and this is only done once], this seems to be reasonable. What could be worrisome is the JDK does allow for more charsets to be added at run-time. In which case - a user could be out of luck.
If we were scared of performance at startup .. we could always have a System.properties of comma separated entries as the source of charset names instead of worrying about Charset.availableCharsets(). In which case "iso8859-1,utf-8" might be enough for some users. -Tim On Mon, Jun 27, 2011 at 11:49 AM, Konstantin Kolinko <knst.koli...@gmail.com > wrote: > 2011/6/27 <ma...@apache.org>: > > Author: markt > > Date: Mon Jun 27 15:19:22 2011 > > New Revision: 1140204 > > > > URL: http://svn.apache.org/viewvc?rev=1140204&view=rev > > Log: > > Need to include aliases in charset cache > > > > Modified: > > tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java > > > I was wondering how slow is Charset.availableCharsets(). > In my test it is about 100ms. Nothing to worry about. > >