View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   *
19   */
20  package org.apache.directory.api.util;
21  
22  
23  /**
24   * Various UTF constants are kept here.
25   *
26   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
27   */
28  public interface UnicodeConstants
29  {
30      int UTF8_MULTI_BYTES_MASK = 0x0080;
31      int UTF8_TWO_BYTES_MASK = 0x00E0;
32      int UTF8_TWO_BYTES = 0x00C0;
33      int UTF8_THREE_BYTES_MASK = 0x00F0;
34      int UTF8_THREE_BYTES = 0x00E0;
35      int UTF8_FOUR_BYTES_MASK = 0x00F8;
36      int UTF8_FOUR_BYTES = 0x00F0;
37      int UTF8_FIVE_BYTES_MASK = 0x00FC;
38      int UTF8_FIVE_BYTES = 0x00F8;
39      int UTF8_SIX_BYTES_MASK = 0x00FE;
40      int UTF8_SIX_BYTES = 0x00FC;
41  
42      /** %01-%27 %2B-%5B %5D-%7F */
43      boolean[] UNICODE_SUBSET =
44          {
45              false, true,  true,  true,  true,  true,  true,  true, // '\0'
46              true,  true,  true,  true,  true,  true,  true,  true,
47              true,  true,  true,  true,  true,  true,  true,  true,
48              true,  true,  true,  true,  true,  true,  true,  true,
49              true,  true,  true,  true,  true,  true,  true,  true,
50              false, false, false, true,  true,  true,  true,  true, // '(', ')', '*'
51              true,  true,  true,  true,  true,  true,  true,  true,
52              true,  true,  true,  true,  true,  true,  true,  true,
53              true,  true,  true,  true,  true,  true,  true,  true,
54              true,  true,  true,  true,  true,  true,  true,  true,
55              true,  true,  true,  true,  true,  true,  true,  true,
56              true,  true,  true,  true,  false, true,  true,  true, // '\'
57              true,  true,  true,  true,  true,  true,  true,  true,
58              true,  true,  true,  true,  true,  true,  true,  true,
59              true,  true,  true,  true,  true,  true,  true,  true,
60              true,  true,  true,  true,  true,  true,  true,  true,
61          };
62      int CHAR_ONE_BYTE_MASK = 0xFFFFFF80;
63      int CHAR_TWO_BYTES_MASK = 0xFFFFF800;
64      int CHAR_THREE_BYTES_MASK = 0xFFFF0000;
65      int CHAR_FOUR_BYTES_MASK = 0xFFE00000;
66      int CHAR_FIVE_BYTES_MASK = 0xFC000000;
67      int CHAR_SIX_BYTES_MASK = 0x80000000;
68  }