public SplFileInfo(Env env, StringValue fileName) { _path = env.lookupPwd(fileName); _parent = _path.getParent(); _fileName = _path.getTail(); }
/** * Converts node tree to a valid xml string. * * @return xml string */ public final Value asXML(Env env, @Optional Value filename) { Value value = toXML(env); if (!value.isString()) { return value; } StringValue str = value.toStringValue(env); if (filename.isDefault()) { return str; } else { Path path = env.lookupPwd(filename); OutputStream os = null; try { os = path.openWrite(); str.writeTo(os); return BooleanValue.TRUE; } catch (IOException e) { env.warning(e); return BooleanValue.FALSE; } finally { if (os != null) { IoUtil.close(os); } } } }
@SuppressWarnings("unchecked") public <T> T marshal(Env env, Value value, Class<T> expectedClass) { return (T) env.lookupPwd(value); }
@SuppressWarnings("unchecked") public <T> T marshal(Env env, Expr expr, Class<T> expectedClass) { return (T) env.lookupPwd(expr.eval(env)); }