View Javadoc

1   /*
2    * EDI-Knight Integration and Transformation Platform
3    * Copyright (C) 2006-2007 Holger Joest <hjoest@users.sourceforge.net>
4    *
5    * This program is free software; you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation; either version 2 of the License, or
8    * (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with this program; if not, write to the Free Software
17   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package net.sf.ediknight.charset;
21  
22  import java.nio.charset.Charset;
23  import java.nio.charset.CharsetDecoder;
24  import java.nio.charset.CharsetEncoder;
25  
26  
27  /***
28   * @author Holger Joest
29   */
30  public final class ISO_646_US
31  extends Charset {
32  
33      private static final String CANONICAL_NAME = "US-ASCII";
34  
35      private static final String[] ALIASES = {
36          // IANA
37          "iso-ir-6",
38          "ANSI_X3.4-1968",
39          "ANSI_X3.4-1986",
40          "ISO_646.irv:1991",
41          "ASCII",
42          "ISO646-US",
43          "us",
44          "IBM367",
45          "cp367",
46          "csASCII",
47          // other
48          "US_ASCII",
49          "ANSI_X3.4",
50          "IA5",
51          "CCITT",
52          "CCITT_V3",
53          "ISO_646",
54          "ISO_646-IRV",
55          "ISO_646-US",
56          "ISO-646",
57          "ISO-646-IRV",
58          "ISO-646-US"
59      };
60  
61      private static final String CHARS =
62          "\u0023\u0024\u0040\u005B//\u005D"
63          + "\u005E\u0060\u007B\u007C\u007D\u007E";
64  
65  
66      /***
67       * Constructor.
68       */
69      public ISO_646_US() {
70          super(CANONICAL_NAME, ALIASES);
71      }
72  
73  
74      /***
75       * {@inheritDoc}
76       * @see java.nio.charset.Charset#contains(java.nio.charset.Charset)
77       */
78      @Override
79      public boolean contains(Charset cs) {
80          return false;
81      }
82  
83  
84      /***
85       * {@inheritDoc}
86       * @see java.nio.charset.Charset#newDecoder()
87       */
88      @Override
89      public CharsetDecoder newDecoder() {
90          return new LegacyCharsetDecoder(this, CHARS);
91      }
92  
93  
94      /***
95       * {@inheritDoc}
96       * @see java.nio.charset.Charset#newEncoder()
97       */
98      @Override
99      public CharsetEncoder newEncoder() {
100         return new LegacyCharsetEncoder(this, CHARS);
101     }
102 
103 }
104