keycloak-service
静的公開メンバ関数 | 静的公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.theme.PropertiesUtil クラス
org.keycloak.theme.PropertiesUtil 連携図
Collaboration graph

静的公開メンバ関数

static Charset detectEncoding (InputStream in) throws IOException
 

静的公開変数類

static final Pattern DETECT_ENCODING_PATTERN
 
static final Charset DEFAULT_ENCODING = Charset.forName("ISO-8859-1")
 

静的非公開変数類

static final Logger logger = Logger.getLogger(PropertiesUtil.class)
 

詳解

著者
Hiroyuki Wada

関数詳解

◆ detectEncoding()

static Charset org.keycloak.theme.PropertiesUtil.detectEncoding ( InputStream  in) throws IOException
inlinestatic

Detect file encoding from the first line of the property file. If the first line in the file doesn't contain the comment with the encoding, it uses ISO-8859-1 as default encoding for backwards compatibility.

The specified stream is closed before this method returns.

引数
inThe input stream
戻り値
Encoding
例外
IOException
55  {
56  try (BufferedReader br = new BufferedReader(new InputStreamReader(in, DEFAULT_ENCODING))) {
57  String firstLine = br.readLine();
58  if (firstLine != null) {
59  Matcher matcher = DETECT_ENCODING_PATTERN.matcher(firstLine);
60  if (matcher.find()) {
61  String encoding = matcher.group(1);
62  if (Charset.isSupported(encoding)) {
63  return Charset.forName(encoding);
64  } else {
65  logger.warnv("Unsupported encoding: {0}", encoding);
66  }
67  }
68  }
69  }
70  return DEFAULT_ENCODING;
71  }
static final Logger logger
Definition: PropertiesUtil.java:35
static final Pattern DETECT_ENCODING_PATTERN
Definition: PropertiesUtil.java:37
static final Charset DEFAULT_ENCODING
Definition: PropertiesUtil.java:40

メンバ詳解

◆ DEFAULT_ENCODING

final Charset org.keycloak.theme.PropertiesUtil.DEFAULT_ENCODING = Charset.forName("ISO-8859-1")
static

◆ DETECT_ENCODING_PATTERN

final Pattern org.keycloak.theme.PropertiesUtil.DETECT_ENCODING_PATTERN
static
初期値:
= Pattern.compile("^#\\s*encoding:\\s*([\\w.:-]+)",
Pattern.CASE_INSENSITIVE)

◆ logger

final Logger org.keycloak.theme.PropertiesUtil.logger = Logger.getLogger(PropertiesUtil.class)
staticprivate

このクラス詳解は次のファイルから抽出されました: