@@ -79,8 +79,6 @@ public class Encoding {
7979
8080 private final Charset charset ;
8181
82- private final boolean asciiSuperset ;
83-
8482 private final boolean obscure ;
8583
8684 private final boolean shouldNot ;
@@ -90,15 +88,6 @@ public class Encoding {
9088 private Encoding actualHtmlEncoding = null ;
9189
9290 static {
93- byte [] testBuf = new byte [0x7F ];
94- for (int i = 0 ; i < 0x7F ; i ++) {
95- if (isAsciiSupersetnessSensitive (i )) {
96- testBuf [i ] = (byte ) i ;
97- } else {
98- testBuf [i ] = (byte ) 0x20 ;
99- }
100- }
101-
10291 Set <Encoding > encodings = new HashSet <Encoding >();
10392
10493 SortedMap <String , Charset > charsets = Charset .availableCharsets ();
@@ -172,12 +161,6 @@ asciiSuperset, isObscure(name), isShouldNot(name),
172161 }
173162 }
174163
175- private static boolean isAsciiSupersetnessSensitive (int c ) {
176- return (c >= 0x09 && c <= 0x0D ) || (c >= 0x20 && c <= 0x22 )
177- || (c >= 0x26 && c <= 0x27 ) || (c >= 0x2C && c <= 0x3F )
178- || (c >= 0x41 && c <= 0x5A ) || (c >= 0x61 && c <= 0x7A );
179- }
180-
181164 private static boolean isObscure (String lowerCasePreferredIanaName ) {
182165 return !(Arrays .binarySearch (NOT_OBSCURE , lowerCasePreferredIanaName ) > -1 );
183166 }
@@ -193,38 +176,6 @@ private static boolean isShouldNot(String lowerCasePreferredIanaName) {
193176 return (Arrays .binarySearch (SHOULD_NOT , lowerCasePreferredIanaName ) > -1 );
194177 }
195178
196- /**
197- * @param testBuf
198- * @param cs
199- */
200- private static boolean asciiMapsToBasicLatin (byte [] testBuf , Charset cs ) {
201- CharsetDecoder dec = cs .newDecoder ();
202- dec .onMalformedInput (CodingErrorAction .REPORT );
203- dec .onUnmappableCharacter (CodingErrorAction .REPORT );
204- Reader r = new InputStreamReader (new ByteArrayInputStream (testBuf ), dec );
205- try {
206- for (int i = 0 ; i < 0x7F ; i ++) {
207- if (isAsciiSupersetnessSensitive (i )) {
208- if (r .read () != i ) {
209- return false ;
210- }
211- } else {
212- if (r .read () != 0x20 ) {
213- return false ;
214- }
215- }
216- }
217- } catch (IOException e ) {
218- return false ;
219- } catch (Exception e ) {
220- return false ;
221- } catch (CoderMalfunctionError e ) {
222- return false ;
223- }
224-
225- return true ;
226- }
227-
228179 private static boolean isLikelyEbcdic (String canonName ,
229180 boolean asciiSuperset ) {
230181 if (!asciiSuperset ) {
@@ -298,15 +249,6 @@ private Encoding(final String canonName, final Charset charset,
298249 this .likelyEbcdic = likelyEbcdic ;
299250 }
300251
301- /**
302- * Returns the asciiSuperset.
303- *
304- * @return the asciiSuperset
305- */
306- public boolean isAsciiSuperset () {
307- return asciiSuperset ;
308- }
309-
310252 /**
311253 * Returns the canonName.
312254 *
0 commit comments