@SuppressWarnings("unchecked")
    private void loadFeatVecGenerator(File modelDirectory, String modelPrefix) throws JChunkerException {
        ObjectInputStream fvGeneratorInputStream = null;
        
        try {
            fvGeneratorInputStream = new ObjectInputStream(new FileInputStream(new File(modelDirectory, modelPrefix + FEAT_VEC_GENERATOR_FILE_EXTENSION)));
            
            // Get the feature vector generator's class name.
            String fvGeneratorClassName = fvGeneratorInputStream.readUTF();
            
            // Load the feature vector generator's class.
            Class<? extends FeatVecGenerator> fvGeneratorClass = (Class<? extends FeatVecGenerator>) Class.forName(fvGeneratorClassName);
            featVecGenerator = fvGeneratorClass.newInstance();
            
            // Load the feature vector generator.
            featVecGenerator.load(modelDirectory, modelPrefix);
        } catch (FileNotFoundException e) {
            throw new JChunkerException("The feature vector generator settings file was not found.", e);
        } catch (IOException e) {
            throw new JChunkerException("An error occurred when loading the feature vector generator settings.", e);
        } catch (ClassNotFoundException e) {
            throw new JChunkerException("The feature vector generator's class could not be found.", e);
        } catch (InstantiationException e) {
            throw new JChunkerException("The feature vector generator's class could not be instantiated.", e);
        } catch (IllegalAccessException e) {
            throw new JChunkerException("The feature vector generator's class was not accessed properly.", e);
        } finally {
            try {
                fvGeneratorInputStream.close();
            } catch (IOException e) {
                throw new JChunkerException("An error occurred when closing the feature vector generator's settings file.", e);
            }
        }
    }