< prev index next >

src/java.base/share/classes/jdk/internal/icu/text/StringPrep.java

Print this page
rev 57619 : imported patch 8174270
   1 /*

   2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.  Oracle designates this
   7  * particular file as subject to the "Classpath" exception as provided
   8  * by Oracle in the LICENSE file that accompanied this code.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 /*
  25 /*
  26  *******************************************************************************
  27  * Copyright (C) 2003-2004, International Business Machines Corporation and         *
  28  * others. All Rights Reserved.                                                *
  29  *******************************************************************************
  30  */
  31 //
  32 // CHANGELOG
  33 //      2005-05-19 Edward Wang
  34 //          - copy this file from icu4jsrc_3_2/src/com/ibm/icu/text/StringPrep.java
  35 //          - move from package com.ibm.icu.text to package sun.net.idn
  36 //          - use ParseException instead of StringPrepParseException
  37 //          - change 'Normalizer.getUnicodeVersion()' to 'NormalizerImpl.getUnicodeVersion()'
  38 //          - remove all @deprecated tag to make compiler happy
  39 //      2007-08-14 Martin Buchholz
  40 //          - remove redundant casts
  41 //
  42 package sun.net.idn;
  43 
  44 import java.io.BufferedInputStream;
  45 import java.io.ByteArrayInputStream;
  46 import java.io.IOException;
  47 import java.io.InputStream;
  48 import java.text.ParseException;
  49 
  50 import sun.text.Normalizer;
  51 import sun.text.normalizer.CharTrie;
  52 import sun.text.normalizer.Trie;
  53 import sun.text.normalizer.VersionInfo;
  54 import sun.text.normalizer.UCharacter;
  55 import sun.text.normalizer.UCharacterIterator;
  56 import sun.text.normalizer.UTF16;
  57 import sun.net.idn.UCharacterDirection;
  58 import sun.net.idn.StringPrepDataReader;
  59 
  60 /**
  61  * StringPrep API implements the StingPrep framework as described by
  62  * <a href="http://www.ietf.org/rfc/rfc3454.txt">RFC 3454</a>.
  63  * StringPrep prepares Unicode strings for use in network protocols.
  64  * Profiles of StingPrep are set of rules and data according to which the
  65  * Unicode Strings are prepared. Each profiles contains tables which describe
  66  * how a code point should be treated. The tables are broadly classied into
  67  * <ul>
  68  *     <li> Unassigned Table: Contains code points that are unassigned
  69  *          in the Unicode Version supported by StringPrep. Currently
  70  *          RFC 3454 supports Unicode 3.2. </li>
  71  *     <li> Prohibited Table: Contains code points that are prohibted from
  72  *          the output of the StringPrep processing function. </li>
  73  *     <li> Mapping Table: Contains code ponts that are deleted from the output or case mapped. </li>
  74  * </ul>
  75  *
  76  * The procedure for preparing Unicode strings:
  77  * <ol>
  78  *      <li> Map: For each character in the input, check if it has a mapping


   1 /*
   2  * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 /*
  26 /*
  27  *******************************************************************************
  28  * Copyright (C) 2003-2004, International Business Machines Corporation and         *
  29  * others. All Rights Reserved.                                                *
  30  *******************************************************************************
  31  */
  32 //
  33 // CHANGELOG
  34 //      2005-05-19 Edward Wang
  35 //          - copy this file from icu4jsrc_3_2/src/com/ibm/icu/text/StringPrep.java
  36 //          - move from package com.ibm.icu.text to package sun.net.idn
  37 //          - use ParseException instead of StringPrepParseException
  38 //          - change 'Normalizer.getUnicodeVersion()' to 'NormalizerImpl.getUnicodeVersion()'
  39 //          - remove all @deprecated tag to make compiler happy
  40 //      2007-08-14 Martin Buchholz
  41 //          - remove redundant casts
  42 //
  43 package jdk.internal.icu.text;
  44 
  45 import java.io.BufferedInputStream;
  46 import java.io.ByteArrayInputStream;
  47 import java.io.IOException;
  48 import java.io.InputStream;
  49 import java.text.ParseException;
  50 
  51 import sun.text.Normalizer;
  52 import jdk.internal.icu.impl.CharTrie;
  53 import jdk.internal.icu.impl.StringPrepDataReader;
  54 import jdk.internal.icu.impl.Trie;
  55 import jdk.internal.icu.lang.UCharacter;
  56 import jdk.internal.icu.lang.UCharacterDirection;
  57 import jdk.internal.icu.util.VersionInfo;


  58 
  59 /**
  60  * StringPrep API implements the StingPrep framework as described by
  61  * <a href="http://www.ietf.org/rfc/rfc3454.txt">RFC 3454</a>.
  62  * StringPrep prepares Unicode strings for use in network protocols.
  63  * Profiles of StingPrep are set of rules and data according to which the
  64  * Unicode Strings are prepared. Each profiles contains tables which describe
  65  * how a code point should be treated. The tables are broadly classied into
  66  * <ul>
  67  *     <li> Unassigned Table: Contains code points that are unassigned
  68  *          in the Unicode Version supported by StringPrep. Currently
  69  *          RFC 3454 supports Unicode 3.2. </li>
  70  *     <li> Prohibited Table: Contains code points that are prohibted from
  71  *          the output of the StringPrep processing function. </li>
  72  *     <li> Mapping Table: Contains code ponts that are deleted from the output or case mapped. </li>
  73  * </ul>
  74  *
  75  * The procedure for preparing Unicode strings:
  76  * <ol>
  77  *      <li> Map: For each character in the input, check if it has a mapping


< prev index next >