private static EditableProperties getEditableProperties(final File bundle) throws IOException { EditableProperties p = new EditableProperties(true); InputStream is = new FileInputStream(bundle); try { p.load(is); } finally { is.close(); } return p; }
/** * Convenience method for loading {@link EditableProperties} from a {@link * FileObject}. New items will alphabetizied by key. * * @param propsFO file representing properties file * @exception FileNotFoundException if the file represented by the given * FileObject does not exists, is a folder rather than a regular * file or is invalid. i.e. as it is thrown by {@link * FileObject#getInputStream()}. */ public static EditableProperties loadProperties(FileObject propsFO) throws IOException { InputStream propsIS = propsFO.getInputStream(); EditableProperties props = new EditableProperties(true); try { props.load(propsIS); } finally { propsIS.close(); } return props; }
public Object run() throws Exception { EditableProperties ep = new EditableProperties(); FileObject propFile = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); InputStream is = propFile.getInputStream(); ep.load(is); is.close(); return ep; } });
@Override public void run(InputStream zipEntryInputStream) { EditableProperties templateProperties = new EditableProperties(false); try { templateProperties.load(zipEntryInputStream); projectProperties.setSiteRootFolder(templateProperties.getProperty(ClientSideProjectConstants.PROJECT_SITE_ROOT_FOLDER)) .setTestFolder(templateProperties.getProperty(ClientSideProjectConstants.PROJECT_TEST_FOLDER)); } catch (IOException ex) { LOGGER.log(Level.WARNING, "Error while reading file", ex); } } }, NB_TEMPLATE_FILTER);