Search in sources :

Example 1 with IO

use of lucee.runtime.util.IO in project Lucee by lucee.

the class Page method str.

public String str(PageContext pc, int off, int len) throws IOException, PageException {
    if (staticTextLocation == null) {
        PageSource ps = getPageSource();
        Mapping m = ps.getMapping();
        staticTextLocation = m.getClassRootDirectory();
        staticTextLocation = staticTextLocation.getRealResource(ps.getJavaName() + ".txt");
    }
    CFMLEngine e = CFMLEngineFactory.getInstance();
    IO io = e.getIOUtil();
    Reader reader = io.getReader(staticTextLocation, e.getCastUtil().toCharset("UTF-8"));
    char[] carr = new char[len];
    try {
        if (off > 0)
            reader.skip(off);
        reader.read(carr);
    } finally {
        io.closeSilent(reader);
    }
    // print.e(carr);
    return new String(carr);
}
Also used : IO(lucee.runtime.util.IO) Reader(java.io.Reader) CFMLEngine(lucee.loader.engine.CFMLEngine)

Aggregations

Reader (java.io.Reader)1 CFMLEngine (lucee.loader.engine.CFMLEngine)1 IO (lucee.runtime.util.IO)1