php.runtime.env.Environment.invokeMethod()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中php.runtime.env.Environment.invokeMethod()方法的一些代码示例,展示了Environment.invokeMethod()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.invokeMethod()方法的具体详情如下:
包路径:php.runtime.env.Environment
类名称:Environment
方法名:invokeMethod

Environment.invokeMethod介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

  1. public Memory invokeMethodNoThrow(IObject object, String name, Memory... args) {
  2. try {
  3. return invokeMethod(object, name, args);
  4. } catch (RuntimeException e) {
  5. throw e;
  6. } catch (Exception e) {
  7. this.catchUncaught(e);
  8. return Memory.NULL;
  9. } catch (Throwable e) {
  10. throw new RuntimeException(e);
  11. }
  12. }

代码示例来源:origin: jphp-group/jphp

  1. default Memory callMethod(Environment env, String name, Memory... args) {
  2. try {
  3. return env.invokeMethod(this, name, args);
  4. } catch (Throwable throwable) {
  5. env.forwardThrow(throwable);
  6. return Memory.NULL;
  7. }
  8. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public void addEmptyEntry(Environment env, PArchiveEntry entry) throws Throwable {
  3. fetchOutput(env);
  4. env.invokeMethod(output, "putEntry", ObjectMemory.valueOf(entry));
  5. env.invokeMethod(output, "closeEntry");
  6. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature({@Arg("path"), @Arg(value = "mode", optional = @Optional("r"))})
  2. public static Memory getContents(Environment env, Memory... args) throws Throwable {
  3. Stream stream = create(env, args[0].toString(), args[1].toString());
  4. try {
  5. return env.invokeMethod(stream, "readFully");
  6. } finally {
  7. env.invokeMethod(stream, "close");
  8. }
  9. }

代码示例来源:origin: jphp-group/jphp

  1. public static Memory fwrite(Environment env, TraceInfo trace, Memory stream, Memory value, Memory length) {
  2. if (stream.instanceOf(Stream.CLASS_NAME)) {
  3. try {
  4. return env.invokeMethod(trace, stream, "write", value, length);
  5. } catch (Throwable throwable) {
  6. env.warning(trace, "fwrite(): " + throwable.getMessage());
  7. return Memory.FALSE;
  8. }
  9. }
  10. env.warning(trace, "fwrite(): unable to write to a non-stream");
  11. return Memory.FALSE;
  12. }

代码示例来源:origin: jphp-group/jphp

  1. public static Memory ftell(Environment env, TraceInfo trace, Memory stream) {
  2. if (stream.instanceOf(Stream.CLASS_NAME)) {
  3. try {
  4. return env.invokeMethod(trace, stream, "getPosition");
  5. } catch (Throwable throwable) {
  6. env.warning(trace, "ftell(): " + throwable.getMessage());
  7. return Memory.FALSE;
  8. }
  9. }
  10. env.warning(trace, "ftell(): unable to get position from a non-stream");
  11. return Memory.FALSE;
  12. }

代码示例来源:origin: jphp-group/jphp

  1. public static Memory feof(Environment env, TraceInfo trace, Memory stream) {
  2. if (stream.instanceOf(Stream.CLASS_NAME)) {
  3. try {
  4. return env.invokeMethod(trace, stream, "eof");
  5. } catch (Throwable throwable) {
  6. env.warning(trace, "feof(): " + throwable.getMessage());
  7. return Memory.FALSE;
  8. }
  9. }
  10. env.warning(trace, "feof(): unable get eof from a non-stream");
  11. return Memory.FALSE;
  12. }

代码示例来源:origin: jphp-group/jphp

  1. public static Memory fread(Environment env, TraceInfo trace, Memory stream, int length) {
  2. if (stream.instanceOf(Stream.CLASS_NAME)) {
  3. try {
  4. return env.invokeMethod(trace, stream, "read", LongMemory.valueOf(length));
  5. } catch (Throwable throwable) {
  6. env.warning(trace, "fread(): " + throwable.getMessage());
  7. return Memory.FALSE;
  8. }
  9. }
  10. env.warning(trace, "fread(): unable to read from a non-stream");
  11. return Memory.FALSE;
  12. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public void write(Environment env, SourceFile file, SourceWriter writer) throws Throwable {
  3. writer.write(env, this, file);
  4. env.invokeMethod(this, "update", ObjectMemory.valueOf(file));
  5. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public void addFromString(Environment env, PArchiveEntry entry, Memory contents) throws Throwable {
  3. fetchOutput(env);
  4. byte[] binaryBytes = contents.getBinaryBytes(env.getDefaultCharset());
  5. env.assignProperty(entry, "size", LongMemory.valueOf(binaryBytes.length));
  6. env.invokeMethod(output, "putEntry", ObjectMemory.valueOf(entry));
  7. outputStream.write(binaryBytes);
  8. env.invokeMethod(output, "closeEntry");
  9. }

代码示例来源:origin: jphp-group/jphp

  1. public static Memory fgetc(Environment env, TraceInfo trace, Memory stream) {
  2. if (stream.instanceOf(Stream.CLASS_NAME)) {
  3. try {
  4. Memory memory = env.invokeMethod(trace, stream, "read", Memory.CONST_INT_1);
  5. return memory.isNull() ? Memory.FALSE : memory;
  6. } catch (Throwable throwable) {
  7. env.warning(trace, "fgetc(): " + throwable.getMessage());
  8. return Memory.FALSE;
  9. }
  10. }
  11. env.warning(trace, "fgetc(): unable to read from a non-stream");
  12. return Memory.FALSE;
  13. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature({@Arg("string"), @Arg("format"), @Arg(value = "flags", optional = @Optional("-1"))})
  2. public static Memory parseAs(Environment env, Memory... args) throws Throwable {
  3. return env.invokeMethod(
  4. WrapProcessor.createByCode(env, args[1].toString(), args[2].toInteger()), "parse", args[0]
  5. );
  6. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature({@Arg("memory"), @Arg("format"), @Arg(value = "flags", optional = @Optional("-1"))})
  2. public static Memory formatAs(Environment env, Memory... args) throws Throwable {
  3. return env.invokeMethod(
  4. WrapProcessor.createByCode(env, args[1].toString(), args[2].toInteger()), "format", args[0]
  5. );
  6. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public void put(Environment env, ForeachIterator iterator) throws Throwable {
  3. while (iterator.next()) {
  4. env.invokeMethod(this, "set", iterator.getMemoryKey(), iterator.getValue());
  5. }
  6. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public Memory __toString(Environment env, Memory... args) throws Throwable {
  3. Memory memory = env.invokeMethod(this, "readFully");
  4. if (memory.isString()) {
  5. return memory;
  6. } else {
  7. return StringMemory.valueOf(memory.toString());
  8. }
  9. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public void update(Environment env, Memory any) throws Throwable {
  3. if (any.instanceOf(SourceFile.class)) {
  4. SourceFile sourceFile = any.toObject(SourceFile.class);
  5. env.invokeMethod(sourceFile, "update", ObjectMemory.valueOf(this));
  6. }
  7. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public static Memory parseAs(Environment env, String input, String format, int flags) throws Throwable {
  3. Stream stream = Stream.create(env, input, "r");
  4. try {
  5. return stream.parseAs(env, StringMemory.valueOf(format), LongMemory.valueOf(flags));
  6. } finally {
  7. env.invokeMethod(stream, "close");
  8. }
  9. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature
  2. public static Memory formatAs(Environment env, String input, Memory value, String format, int flags) throws Throwable {
  3. Stream stream = Stream.create(env, input, "w");
  4. try {
  5. return stream.writeFormatted(env, value, StringMemory.valueOf(format), LongMemory.valueOf(flags));
  6. } finally {
  7. env.invokeMethod(stream, "close");
  8. }
  9. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature({
  2. @Arg("value"),
  3. @Arg(value = "format", type = HintType.STRING),
  4. @Arg(value = "flags", optional = @Optional("-1"))
  5. })
  6. public Memory writeFormatted(Environment env, Memory... args) throws Throwable {
  7. WrapProcessor processor = WrapProcessor.createByCode(env, args[1].toString(), args[2].toInteger());
  8. return env.invokeMethod(processor, "formatTo", args[0], ObjectMemory.valueOf(this));
  9. }

代码示例来源:origin: jphp-group/jphp

  1. @Signature({
  2. @Arg(value = "format", type = HintType.STRING),
  3. @Arg(value = "flags", optional = @Optional("-1"))
  4. })
  5. public Memory readFormatted(Environment env, Memory... args) throws Throwable {
  6. WrapProcessor processor = WrapProcessor.createByCode(env, args[0].toString(), args[1].toInteger());
  7. return env.invokeMethod(processor, "parse", ObjectMemory.valueOf(this));
  8. }

相关文章