Code example for AtomicReference

0
  /** A cheap and type-safe constant for the US-ASCII Charset. */ 
  public static final Charset US_ASCII = Charset.forName("US-ASCII");
 
  /** A cheap and type-safe constant for the UTF-8 Charset. */ 
  public static final Charset UTF_8 = Charset.forName("UTF-8");
  private static AtomicReference<byte[]> skipBuffer = new AtomicReference<byte[]>();
 
  private static final char[] DIGITS =
      { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 
 
  private Util() { 
  } 
 
  public static int getEffectivePort(URI uri) {
    return getEffectivePort(uri.getScheme(), uri.getPort());
  } 
 
  public static int getEffectivePort(URL url) {
    return getEffectivePort(url.getProtocol(), url.getPort());
  }