/* * [DetectNewEncodings.java] * * Summary: Detect encodings newly supported in this Java release. * * Copyright: (c) 2015-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2015-10-18 initial version */ package com.mindprod.encodings; import com.mindprod.csv.CSVReader; import java.io.EOFException; import java.io.FileReader; import java.io.IOException; import java.nio.charset.Charset; import java.util.HashSet; import java.util.SortedMap; import static java.lang.System.*; /** * Detect encodings newly supported in this Java release. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2015-10-18 initial version * @since 2015-10-18 */ public final class DetectNewEncodings { private static HashSet knownEncodings = new HashSet( 250 ); /** * load up the list of encodings we already know about */ private static void getKnownEncodings() throws IOException { // strip comments CSVReader r = new CSVReader( new FileReader( "E:/com/mindprod/encodings/all.csv" ) ); try { while ( true ) { final String encoding = r.get(); r.skipToNextLine(); knownEncodings.add( encoding ); } } catch ( EOFException e ) { } } /** * Detect encodings newly supported in this Java release. * all.csv has encodings we already know about * * @param args command line arguments ignored. */ public static void main( String args[] ) throws IOException { getKnownEncodings(); SortedMap newEncodings = Charset.availableCharsets(); for ( String newEncoding : newEncodings.keySet() ) { if ( !knownEncodings.contains( newEncoding ) ) { out.println( "NEW ENCODING: " + newEncoding ); } } } // end main }