/** * Load a classifier from the specified InputStream. No extra properties are * supplied. This does not close the InputStream. * * @param in The InputStream to load the serialized classifier from * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public void loadClassifier(InputStream in) throws IOException, ClassCastException, ClassNotFoundException { loadClassifier(in, null); }
/** * Loads a classifier from the file specified by loadPath. If loadPath ends in * .gz, uses a GZIPInputStream, else uses a regular FileInputStream. */ public void loadClassifier(String loadPath) throws ClassCastException, IOException, ClassNotFoundException { loadClassifier(loadPath, null); }
public void loadClassifier(File file) throws ClassCastException, IOException, ClassNotFoundException { loadClassifier(file, null); }
/** * Load a classifier from the specified InputStream. The classifier is * reinitialized from the flags serialized in the classifier. This does not * close the InputStream. * * @param in The InputStream to load the serialized classifier from * @param props This Properties object will be used to update the * SeqClassifierFlags which are read from the serialized classifier * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public void loadClassifier(InputStream in, Properties props) throws IOException, ClassCastException, ClassNotFoundException { loadClassifier(new ObjectInputStream(in), props); }
public void loadClassifierNoExceptions(String loadPath, Properties props) { try { loadClassifier(loadPath, props); } catch (IOException e) { throw new RuntimeIOException(e); } catch (ClassCastException|ClassNotFoundException e) { throw new RuntimeException(e); } }
public void loadClassifierNoExceptions(File file, Properties props) { try { loadClassifier(file, props); } catch (Exception e) { log.info("Error deserializing " + file.getAbsolutePath()); throw new RuntimeException(e); } }
/** * Loads a classifier from the given input stream. * Any exceptions are rethrown as unchecked exceptions. * This method does not close the InputStream. * * @param in The InputStream to read from */ public void loadClassifierNoExceptions(InputStream in, Properties props) { // load the classifier try { loadClassifier(in, props); } catch (IOException e) { throw new RuntimeIOException(e); } catch (ClassNotFoundException cnfe) { throw new RuntimeException(cnfe); } }
/** * Loads a classifier from the file specified. If the file's name ends in .gz, * uses a GZIPInputStream, else uses a regular FileInputStream. This method * closes the File when done. * * @param file Loads a classifier from this file. * @param props Properties in this object will be used to overwrite those * specified in the serialized classifier * * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public void loadClassifier(File file, Properties props) throws ClassCastException, IOException, ClassNotFoundException { Timing t = new Timing(); BufferedInputStream bis; if (file.getName().endsWith(".gz")) { bis = new BufferedInputStream(new GZIPInputStream(new FileInputStream(file))); } else { bis = new BufferedInputStream(new FileInputStream(file)); } try { loadClassifier(bis, props); t.done(log, "Loading classifier from " + file.getAbsolutePath()); } finally { bis.close(); } }
/** * Loads a classifier from the file, classpath resource, or URL specified by loadPath. If loadPath ends in * .gz, uses a GZIPInputStream. */ public void loadClassifier(String loadPath, Properties props) throws ClassCastException, IOException, ClassNotFoundException { try (InputStream is = IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(loadPath)) { Timing t = new Timing(); loadClassifier(is, props); t.done(log, "Loading classifier from " + loadPath); } }
/** * Loads a classifier from the file specified by loadPath. If loadPath ends in * .gz, uses a GZIPInputStream, else uses a regular FileInputStream. */ public void loadClassifier(String loadPath) throws ClassCastException, IOException, ClassNotFoundException { loadClassifier(loadPath, null); }
/** * Load a classifier from the specified InputStream. No extra properties are * supplied. This does not close the InputStream. * * @param in The InputStream to load the serialized classifier from * @throws IOException If there are problems accessing the input stream * @throws ClassCastException If there are problems interpreting the serialized data * @throws ClassNotFoundException If there are problems interpreting the serialized data */ public void loadClassifier(InputStream in) throws IOException, ClassCastException, ClassNotFoundException { loadClassifier(in, null); }
/** * Loads a classifier from the file specified by loadPath. If loadPath ends * in .gz, uses a GZIPInputStream, else uses a regular FileInputStream. */ public void loadClassifier(String loadPath) throws ClassCastException, IOException, ClassNotFoundException { loadClassifier(loadPath, null); }
/** * Loads a classifier from the file specified by loadPath. If loadPath ends in * .gz, uses a GZIPInputStream, else uses a regular FileInputStream. */ public void loadClassifier(String loadPath) throws ClassCastException, IOException, ClassNotFoundException { loadClassifier(loadPath, null); }
public void loadClassifier(File file) throws ClassCastException, IOException, ClassNotFoundException { loadClassifier(file, null); }
public void loadClassifier(File file) throws ClassCastException, IOException, ClassNotFoundException { loadClassifier(file, null); }
public void loadClassifierNoExceptions(File file, Properties props) { try { loadClassifier(file, props); } catch (Exception e) { System.err.println("Error deserializing " + file.getAbsolutePath()); throw new RuntimeException(e); } }
public void loadClassifierNoExceptions(File file, Properties props) { try { loadClassifier(file, props); } catch (Exception e) { System.err.println("Error deserializing " + file.getAbsolutePath()); throw new RuntimeException(e); } }
public void loadClassifierNoExceptions(String loadPath, Properties props) { try { loadClassifier(loadPath, props); } catch (IOException e) { throw new RuntimeIOException(e); } catch (ClassCastException|ClassNotFoundException e) { throw new RuntimeException(e); } }
public void loadClassifierNoExceptions(File file, Properties props) { try { loadClassifier(file, props); } catch (Exception e) { log.info("Error deserializing " + file.getAbsolutePath()); throw new RuntimeException(e); } }
/** * Loads a classifier from the file, classpath resource, or URL specified by loadPath. If loadPath ends in * .gz, uses a GZIPInputStream. */ public void loadClassifier(String loadPath, Properties props) throws ClassCastException, IOException, ClassNotFoundException { try (InputStream is = IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(loadPath)) { Timing t = new Timing(); loadClassifier(is, props); t.done(log, "Loading classifier from " + loadPath); } }