Loads the given text as a template
@param text Template text
@return Loaded template
@throws IOException
@throws ParseException
355949
public Template loadInline(String text) throws IOException, ParseException {
    
		try(InlineTemplateSource templateSource = new InlineTemplateSource(text)) {
		
			return load("inline", templateSource);
		}
		
  }
386157
public static Model newModel(String text) {
        Model m = new Model();

        m.loadModelFromText(text);

        return m;
    }
686126
public void loadTemplateClass(TemplateClass tc) {
        if (!readEnabled()) {
            return;
        }
        InputStream is = null;
        try {
            File f = getCacheFile(tc);
            if (!f.exists() || !f.canRead()) return;
            is = new BufferedInputStream(new FileInputStream(f));

            // --- check hash
            int offset = 0;
            int read;
            StringBuilder hash = new StringBuilder();
            while ((read = is.read()) != 0) {
                if (read == -1) {
                    logger.error("Failed to read cache file for template class: %s", tc);
                    return;
                }
                hash.append((char) read);
                offset++;
            }

            //check hash only in non precompiled mode
            if (!conf.loadPrecompiled()) {
                String curHash = hash(tc);
                if (!curHash.equals(hash.toString())) {
                    if (logger.isTraceEnabled()) {
                        logger.trace("Bytecode too old (%s != %s)", hash, curHash);
                    }
                    return;
                }
            }

            // --- load java source
            read = -1;
            StringBuilder source = new StringBuilder();
            while ((read = is.read()) != 0) {
                source.append((char) read);
                offset++;
            }
            if (source.length() != 0) {
                String s = source.toString();
                String[] sa = s.split("__INCLUDED_TAG_TYPES__");
                tc.javaSource = sa[0];
                s = sa[1];
                sa = s.split("__INCULDED_TEMPLATE_CLASS_NAME_LIST__");
                tc.deserializeIncludeTagTypes(sa[0]);
                s = sa[1];
                sa = s.split("__IMPORT_PATH_LIST__");
                tc.setIncludeTemplateClassNames(sa[0]);
                if (sa.length > 1) {
                    s = sa[1];
                    sa = s.split(";");
                    Set<String> importPaths = new HashSet<String>();
                    for (String path : sa) {
                        if ("java.lang".equals(path)) continue;
                        importPaths.add(path);
                    }
                    tc.replaceImportPath(importPaths);
                }
            } // else it must be an inner class

            // --- load byte code
            byte[] byteCode = new byte[(int) f.length() - (offset + 2)];
            is.read(byteCode);
            tc.loadCachedByteCode(byteCode);

        } catch (Exception e) {
            throw new RuntimeException(e);
        }finally {
            if(is != null)
                try {
                    is.close();
                } catch (IOException e) {
                    logger.error(e.getMessage(), e);
                }
        }
    }
1110619
public void parse(byte[] data) throws ParseException {
        Text text = new Text();
        text.strain(data, 0, data.length);
        init(text);
    }
1064245
public Element text(String text) {
        Validate.notNull(text);

        empty();
        TextNode textNode = new TextNode(text);
        appendChild(textNode);

        return this;
    }
84523
public XMLSerializer text(String text) throws IOException {
		// assert text != null;
		if (startTagIncomplete || setPrefixCalled)
			closeStartTag();
		if (doIndent && seenTag)
			seenTag = false;
		writeElementContent(text, out);
		return this;
	}
707774
private File getTemplateFile(String filename) throws IOException {
        File templateFile=null;
        final String resource = TEMPLATE_RESOURCES_PATH + "/" + filename;
        InputStream is = Setup.class.getClassLoader().getResourceAsStream(resource);
        if (null == is) {
            throw new RuntimeException("Unable to load required template: " + resource);
        }
        templateFile = File.createTempFile("temp", filename);
        templateFile.deleteOnExit();
        try {
            return copyToNativeLineEndings(is, templateFile);
        } finally {
            is.close();
        }
    }
34729
static Given given(String text) {
        reset();
        final Given given = new Given(text);
        sRoot = given;
        return given;
    }
1215103
public static String readTemplate(String root, String template) throws IOException {
		if (root == null) {
			return readTemplate(template);
		}
		String settingsFile = root + "/" + Defaults.TemplateDir + "/" + template + Defaults.JsonFileExtension;
		return readFileFromClasspath(settingsFile);
	}
996897
public List<AnalyzedSentence> analyzeText(String text) throws IOException {
    List<String> sentences = sentenceTokenize(text);
    return analyzeSentences(sentences);
  }
591322
public void setAsText(final String text) {
        if (BeanUtils.isNull(text)) {
            setValue(null);
            return;
        }
        try {
            Object newValue = Short.decode(text);
            setValue(newValue);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Failed to parse short.", e);
        }
    }
995566
public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
    {
        int length = text.length();
        int begin = 0;
        BaseNode<V> state = this;

        for (int i = begin; i < length; ++i)
        {
            state = state.transition(text.charAt(i));
            if (state != null)
            {
                V value = state.getValue();
                if (value != null)
                {
                    processor.hit(begin, i + 1, value);
                }
            }
            else
            {
                i = begin;
                ++begin;
                state = this;
            }
        }
    }
631447
public function loadModelFromText($text)
    {
        $cfg = Config::newConfigFromText($text);

        $this->loadSection($cfg, 'r');
        $this->loadSection($cfg, 'p');
        $this->loadSection($cfg, 'e');
        $this->loadSection($cfg, 'm');

        $this->loadSection($cfg, 'g');
    }
87597
public static <T> T toBean(String text, Class<T> clazz) {
        return JSON.parseObject(text, clazz);
    }
213443
public Template getTemplate(String name) throws IOException, ParseException {
        return getTemplate(name, null, null, null);
    }
69922
public ParagraphBuilder span(final String text) {
		final ParagraphElement paragraphElement = new Span(text);
		this.paragraphElements.add(paragraphElement);
		return this;
	}
913911
public List<Hit<V>> parseText(String text)
    {
        int position = 1;
        int currentState = 0;
        List<Hit<V>> collectedEmits = new LinkedList<Hit<V>>();
        for (int i = 0; i < text.length(); ++i)
        {
            currentState = getState(currentState, text.charAt(i));
            storeEmits(position, currentState, collectedEmits);
            ++position;
        }

        return collectedEmits;
    }