Debian Codegraph @

minidns-core/src/main/java/org/minidns/idna/MiniDnsIdna.java

raw
1 /*
2 * Copyright 2015-2020 the original author or authors
3 *
4 * This software is licensed under the Apache License, Version 2.0,
5 * the GNU Lesser General Public License version 2 or later ("LGPL")
6 * and the WTFPL.
7 * You may choose either license to govern your use of this software only
8 * upon the condition that you accept all of the terms of either
9 * the Apache License 2.0, the LGPL 2.1+ or the WTFPL.
10 */
11 package org.minidns.idna;
12
13 public class MiniDnsIdna {
14
15 private static IdnaTransformator idnaTransformator = new DefaultIdnaTransformator();
16
17 public static String toASCII(String string) {
18 return idnaTransformator.toASCII(string);
19 }
20
21 public static String toUnicode(String string) {
22 return idnaTransformator.toUnicode(string);
23 }
24
25 public static void setActiveTransformator(IdnaTransformator idnaTransformator) {
26 if (idnaTransformator == null) {
27 throw new IllegalArgumentException();
28 }
29 MiniDnsIdna.idnaTransformator = idnaTransformator;
30 }
31 }