obb = ru.vassaev.core.thread.Process.getByteBuffer(8000, is);
is.close();
obb.close();
v = obb.getIS();
} catch(IOException e) {
throw new CalculateException(gl_name, e);
}
}
InputStream dh;
if (v == null)
return null;
if (v instanceof String || v instanceof StringBuffer) {
String val = v.toString().trim();
if (val.indexOf("<?") != 0) {
val = "<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>" + val;
}
try {
dh = new java.io.ByteArrayInputStream(val.getBytes(encoding));
} catch (UnsupportedEncodingException e) {
throw new CalculateException(gl_name, e);
}
} else if (v instanceof InputStream) {
if (!isHeader) {
dh = (InputStream) v;
} else {
InputStream h;
try {
h = new java.io.ByteArrayInputStream(
("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>")
.getBytes(encoding));
} catch (UnsupportedEncodingException e) {
throw new CalculateException(gl_name, e);
}
dh = new java.io.SequenceInputStream(h, (InputStream) v);
}
} else
throw new CalculateException(gl_name, "The source's type isn't supported:" + v.getClass().getCanonicalName());
try {
Document d = XMLFileWaiter.getDocument(dh, encoding);
if (d != null)
return modify(tl, cntx, d.getDocumentElement());
return null;