public Template(File file) throws Exception { if (file.length() > maxF) tools.util.LogMgr.red(file.length() + " Large Size Template " + file); String templ = new String(SharedMethods.getBytesFromFile(file)); m_template = new StringBuffer(templ); m_template2 = new StringBuffer(templ); m_file = file.toString(); }
/** Constructs a new Template with the specified template. */ public Template(String file, boolean cr) throws Exception { if (cr) new File(file).createNewFile(); if (file.length() > maxF) tools.util.LogMgr.red(file.length() + " Large Size Template " + file); String templ = new String(SharedMethods.getBytesFromFile(file)); m_template = new StringBuffer(templ); m_template2 = new StringBuffer(templ); m_file = file; }
/** * Sets the Tag for the specified tag. * * @param tag the tag template to be replaced * @param tagvalue the value of the tag */ public boolean setTag(String tag, String tagvalue) { if (tag.equals(tagvalue)) { tools.util.LogMgr.debug(" CANNOT setTag Template - IDENTICAL " + tag); return false; } if (m_template.toString().indexOf(tag) > -1) { m_template = SharedMethods.replaceSubstringBuffer(m_template, tag, tagvalue); return true; } else return false; }
public void setFirstTag(String tag, String tagvalue) { m_template = SharedMethods.replaceFirstSubstringBuffer(m_template, tag, tagvalue); }