本文整理了Java中php.runtime.env.Environment.invokeMethod()
方法的一些代码示例,展示了Environment.invokeMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.invokeMethod()
方法的具体详情如下:
包路径:php.runtime.env.Environment
类名称:Environment
方法名:invokeMethod
暂无
代码示例来源:origin: jphp-group/jphp
public Memory invokeMethodNoThrow(IObject object, String name, Memory... args) {
try {
return invokeMethod(object, name, args);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
this.catchUncaught(e);
return Memory.NULL;
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: jphp-group/jphp
default Memory callMethod(Environment env, String name, Memory... args) {
try {
return env.invokeMethod(this, name, args);
} catch (Throwable throwable) {
env.forwardThrow(throwable);
return Memory.NULL;
}
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void addEmptyEntry(Environment env, PArchiveEntry entry) throws Throwable {
fetchOutput(env);
env.invokeMethod(output, "putEntry", ObjectMemory.valueOf(entry));
env.invokeMethod(output, "closeEntry");
}
代码示例来源:origin: jphp-group/jphp
@Signature({@Arg("path"), @Arg(value = "mode", optional = @Optional("r"))})
public static Memory getContents(Environment env, Memory... args) throws Throwable {
Stream stream = create(env, args[0].toString(), args[1].toString());
try {
return env.invokeMethod(stream, "readFully");
} finally {
env.invokeMethod(stream, "close");
}
}
代码示例来源:origin: jphp-group/jphp
public static Memory fwrite(Environment env, TraceInfo trace, Memory stream, Memory value, Memory length) {
if (stream.instanceOf(Stream.CLASS_NAME)) {
try {
return env.invokeMethod(trace, stream, "write", value, length);
} catch (Throwable throwable) {
env.warning(trace, "fwrite(): " + throwable.getMessage());
return Memory.FALSE;
}
}
env.warning(trace, "fwrite(): unable to write to a non-stream");
return Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
public static Memory ftell(Environment env, TraceInfo trace, Memory stream) {
if (stream.instanceOf(Stream.CLASS_NAME)) {
try {
return env.invokeMethod(trace, stream, "getPosition");
} catch (Throwable throwable) {
env.warning(trace, "ftell(): " + throwable.getMessage());
return Memory.FALSE;
}
}
env.warning(trace, "ftell(): unable to get position from a non-stream");
return Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
public static Memory feof(Environment env, TraceInfo trace, Memory stream) {
if (stream.instanceOf(Stream.CLASS_NAME)) {
try {
return env.invokeMethod(trace, stream, "eof");
} catch (Throwable throwable) {
env.warning(trace, "feof(): " + throwable.getMessage());
return Memory.FALSE;
}
}
env.warning(trace, "feof(): unable get eof from a non-stream");
return Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
public static Memory fread(Environment env, TraceInfo trace, Memory stream, int length) {
if (stream.instanceOf(Stream.CLASS_NAME)) {
try {
return env.invokeMethod(trace, stream, "read", LongMemory.valueOf(length));
} catch (Throwable throwable) {
env.warning(trace, "fread(): " + throwable.getMessage());
return Memory.FALSE;
}
}
env.warning(trace, "fread(): unable to read from a non-stream");
return Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void write(Environment env, SourceFile file, SourceWriter writer) throws Throwable {
writer.write(env, this, file);
env.invokeMethod(this, "update", ObjectMemory.valueOf(file));
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void addFromString(Environment env, PArchiveEntry entry, Memory contents) throws Throwable {
fetchOutput(env);
byte[] binaryBytes = contents.getBinaryBytes(env.getDefaultCharset());
env.assignProperty(entry, "size", LongMemory.valueOf(binaryBytes.length));
env.invokeMethod(output, "putEntry", ObjectMemory.valueOf(entry));
outputStream.write(binaryBytes);
env.invokeMethod(output, "closeEntry");
}
代码示例来源:origin: jphp-group/jphp
public static Memory fgetc(Environment env, TraceInfo trace, Memory stream) {
if (stream.instanceOf(Stream.CLASS_NAME)) {
try {
Memory memory = env.invokeMethod(trace, stream, "read", Memory.CONST_INT_1);
return memory.isNull() ? Memory.FALSE : memory;
} catch (Throwable throwable) {
env.warning(trace, "fgetc(): " + throwable.getMessage());
return Memory.FALSE;
}
}
env.warning(trace, "fgetc(): unable to read from a non-stream");
return Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
@Signature({@Arg("string"), @Arg("format"), @Arg(value = "flags", optional = @Optional("-1"))})
public static Memory parseAs(Environment env, Memory... args) throws Throwable {
return env.invokeMethod(
WrapProcessor.createByCode(env, args[1].toString(), args[2].toInteger()), "parse", args[0]
);
}
代码示例来源:origin: jphp-group/jphp
@Signature({@Arg("memory"), @Arg("format"), @Arg(value = "flags", optional = @Optional("-1"))})
public static Memory formatAs(Environment env, Memory... args) throws Throwable {
return env.invokeMethod(
WrapProcessor.createByCode(env, args[1].toString(), args[2].toInteger()), "format", args[0]
);
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void put(Environment env, ForeachIterator iterator) throws Throwable {
while (iterator.next()) {
env.invokeMethod(this, "set", iterator.getMemoryKey(), iterator.getValue());
}
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory __toString(Environment env, Memory... args) throws Throwable {
Memory memory = env.invokeMethod(this, "readFully");
if (memory.isString()) {
return memory;
} else {
return StringMemory.valueOf(memory.toString());
}
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void update(Environment env, Memory any) throws Throwable {
if (any.instanceOf(SourceFile.class)) {
SourceFile sourceFile = any.toObject(SourceFile.class);
env.invokeMethod(sourceFile, "update", ObjectMemory.valueOf(this));
}
}
代码示例来源:origin: jphp-group/jphp
@Signature
public static Memory parseAs(Environment env, String input, String format, int flags) throws Throwable {
Stream stream = Stream.create(env, input, "r");
try {
return stream.parseAs(env, StringMemory.valueOf(format), LongMemory.valueOf(flags));
} finally {
env.invokeMethod(stream, "close");
}
}
代码示例来源:origin: jphp-group/jphp
@Signature
public static Memory formatAs(Environment env, String input, Memory value, String format, int flags) throws Throwable {
Stream stream = Stream.create(env, input, "w");
try {
return stream.writeFormatted(env, value, StringMemory.valueOf(format), LongMemory.valueOf(flags));
} finally {
env.invokeMethod(stream, "close");
}
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg("value"),
@Arg(value = "format", type = HintType.STRING),
@Arg(value = "flags", optional = @Optional("-1"))
})
public Memory writeFormatted(Environment env, Memory... args) throws Throwable {
WrapProcessor processor = WrapProcessor.createByCode(env, args[1].toString(), args[2].toInteger());
return env.invokeMethod(processor, "formatTo", args[0], ObjectMemory.valueOf(this));
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg(value = "format", type = HintType.STRING),
@Arg(value = "flags", optional = @Optional("-1"))
})
public Memory readFormatted(Environment env, Memory... args) throws Throwable {
WrapProcessor processor = WrapProcessor.createByCode(env, args[0].toString(), args[1].toInteger());
return env.invokeMethod(processor, "parse", ObjectMemory.valueOf(this));
}
内容来源于网络,如有侵权,请联系作者删除!