public void generateJangarooClasses(ResourceBundleClass rbc) throws IOException, TemplateException { for (PropertiesClass pl : rbc.getPropertiesClasses()) { String rel = pl.getSrcFile().getPath().substring(suite.getRootDir().getPath().length()); String convertedName = FileUtils.dirname(rel) + "/" + rbc.getClassName() + "_properties"; if (pl.getLocale() != null) { convertedName += "_" + pl.getLocale(); } convertedName += ".as"; File outputFile = new File(suite.getOutputDir(), convertedName); if (!outputFile.getParentFile().exists()) { if (outputFile.getParentFile().mkdirs()) { Log.e("Could not create output folder"); } } Writer writer = null; try { writer = new OutputStreamWriter(new FileOutputStream(outputFile), outputCharset); generatePropertiesClass(pl, writer); } catch (IOException e) { Log.e("error while generating class", e); } catch (TemplateException e) { Log.e("error while generating class", e); } finally { try { if (writer != null) { writer.close(); } } catch (IOException e) { // never happen } } } }
public void generate() throws IOException, TemplateException { for (ResourceBundleClass rbc : suite.getResourceBundles()) { generateJangarooClasses(rbc); } }