public static FSA read ( InputStream stream ) throws IOException { final FSAHeader header = FSAHeader . read ( stream ) ; switch ( header . version ) { case FSA5 . VERSION : return new FSA5 ( stream ) ; case CFSA . VERSION : return new CFSA ( stream ) ; case CFSA2 . VERSION : return new CFSA2 ( stream ) ; default : throw new IOException ( String . format ( Locale . ROOT , "Unsupported automaton version: 0x%02x" , header . version & 0xFF ) ) ; } }
A factory for reading automata in any of the supported versions .