2 *******************************************************************************
\r
3 * Copyright (C) 2009, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
7 package com.ibm.icu.impl.locale;
\r
9 import com.ibm.icu.impl.locale.LanguageTag.ParseStatus;
\r
11 public class PrivateuseExtension extends Extension {
\r
12 public static final char SINGLETON = 'x';
\r
14 protected PrivateuseExtension() {
\r
19 * package local constructor only used by LanguageTag implementation
\r
21 PrivateuseExtension(String privuse) {
\r
26 protected void setExtensionValue(StringTokenIterator itr, ParseStatus sts) {
\r
27 if (sts.isError() || itr.isDone()) {
\r
32 StringBuilder buf = new StringBuilder();
\r
33 while (!itr.isDone()) {
\r
34 String s = itr.current();
\r
35 if (!LanguageTag.isPrivateuseSubtag(s)) {
\r
38 s = LanguageTag.canonicalizePrivateuseSubtag(s);
\r
39 if (buf.length() != 0) {
\r
40 buf.append(LanguageTag.SEP);
\r
43 sts.parseLength = itr.currentEnd();
\r
47 if (buf.length() == 0) {
\r
50 _value = buf.toString();
\r