/** * Load an object from an input stream. * @param is The input stream to read from. * @return The loaded object. */ public static Object loadObject(final InputStream is) { final String header = EncogDirectoryPersistence.readLine(is); final String[] params = header.split(","); if (!"encog".equals(params[0])) { throw new PersistError("Not a valid EG file."); } final String name = params[1]; final EncogPersistor p = PersistorRegistry.getInstance().getPersistor( name); if (p == null) { throw new PersistError("Do not know how to read the object: " + name); } if (p.getFileVersion() < Integer.parseInt(params[4])) { throw new PersistError( "The file you are trying to read is from a later version of Encog. Please upgrade Encog to read this file."); } return p.read(is); }