com.sun.grizzly.util
Class Charsets

java.lang.Object
  extended by com.sun.grizzly.util.Charsets

public final class Charsets
extends java.lang.Object

Charset utility class.

Author:
Alexey Stashok

Field Summary
static java.nio.charset.Charset ASCII_CHARSET
           
static java.lang.String DEFAULT_CHARACTER_ENCODING
           
static java.nio.charset.Charset DEFAULT_CHARSET
           
static java.nio.charset.Charset UTF8_CHARSET
           
 
Constructor Summary
Charsets()
           
 
Method Summary
static void drainAllCharsets()
          Removes all the charsets preloaded before.
static java.nio.charset.Charset lookupCharset(java.lang.String charsetName)
          Lookup a Charset by name.
static void preloadAllCharsets()
          Preloads all JVM available Charsets, which makes charset search faster (for memory cost), especially non-existed charsets, because it lets us avoid pretty expensive Charset.forName(java.lang.String) call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHARACTER_ENCODING

public static final java.lang.String DEFAULT_CHARACTER_ENCODING
See Also:
Constant Field Values

ASCII_CHARSET

public static final java.nio.charset.Charset ASCII_CHARSET

UTF8_CHARSET

public static final java.nio.charset.Charset UTF8_CHARSET

DEFAULT_CHARSET

public static final java.nio.charset.Charset DEFAULT_CHARSET
Constructor Detail

Charsets

public Charsets()
Method Detail

lookupCharset

public static java.nio.charset.Charset lookupCharset(java.lang.String charsetName)
Lookup a Charset by name. Fixes Charset concurrency issue (http://paul.vox.com/library/post/the-mysteries-of-java-character-set-performance.html)

Parameters:
charsetName -
Returns:
Charset

preloadAllCharsets

public static void preloadAllCharsets()
Preloads all JVM available Charsets, which makes charset search faster (for memory cost), especially non-existed charsets, because it lets us avoid pretty expensive Charset.forName(java.lang.String) call.


drainAllCharsets

public static void drainAllCharsets()
Removes all the charsets preloaded before.



Copyright © 2012 Oracle Corporation. All Rights Reserved.