/** * Load a classifier packaged by {@link #packageClassifier(File)} from an {@link InputStream}. * * This method should typically not be overridden by subclasses - use * {@link #unpackageClassifier(JarInputStream)} and {@link #newClassifier()} instead. * * @param inputStream * The classifier stream. * @return The loaded classifier. */ public CLASSIFIER_TYPE loadClassifier(InputStream inputStream) throws IOException { // if it's already a Jar stream, don't re-wrap it if (inputStream instanceof JarInputStream) { JarInputStream modelStream = (JarInputStream) inputStream; this.unpackageClassifier(modelStream); return this.newClassifier(); } // if we need to wrap it in a Jar stream, be sure to close the stream afterwards else { JarInputStream modelStream = new JarInputStream(inputStream); try { this.unpackageClassifier(modelStream); return this.newClassifier(); } finally { modelStream.close(); } } }