本文整理了Java中php.runtime.Memory.toInteger()
方法的一些代码示例,展示了Memory.toInteger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Memory.toInteger()
方法的具体详情如下:
包路径:php.runtime.Memory
类名称:Memory
方法名:toInteger
暂无
代码示例来源:origin: jphp-group/jphp
public static void debug_print_backtrace(Environment env, TraceInfo trace, int options, int limit) {
boolean provideObject = (options & LangConstants.DEBUG_BACKTRACE_PROVIDE_OBJECT.toInteger())
== LangConstants.DEBUG_BACKTRACE_PROVIDE_OBJECT.toInteger();
boolean ignoreArgs = (options & LangConstants.DEBUG_BACKTRACE_IGNORE_ARGS.toInteger())
== LangConstants.DEBUG_BACKTRACE_IGNORE_ARGS.toInteger();
StackTracer stackTracer = new StackTracer(env, limit);
env.echo(stackTracer.toString(!ignoreArgs));
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("timeout"))
public Memory setSoTimeout(Environment env, Memory... args) throws SocketException {
socket.setSoTimeout(args[0].toInteger());
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("port"))
public static Memory isAvailableLocalPort(Environment env, Memory... args) {
try {
ServerSocket serverSocket = new ServerSocket(args[0].toInteger());
serverSocket.close();
return Memory.TRUE;
} catch (IOException e) {
return Memory.FALSE;
}
}
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("value"))
public Memory setPriority(Environment env, Memory... args){
thread.setPriority(args[0].toInteger());
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg("start"),
@Arg("end")
})
public Memory region(Environment env, Memory... args) {
matcher.region(args[0].toInteger(), args[1].toInteger());
return new ObjectMemory(this);
}
代码示例来源:origin: jphp-group/jphp
@Override
public Memory valueOfIndex(TraceInfo trace, Memory index) {
int i = index.toInteger();
if (i < 0 || i >= bytes.length)
return FALSE;
return new StringMemory((char)(bytes[i] & 0xFF));
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("size"))
public Memory setReceiveBufferSize(Environment env, Memory... args) throws SocketException {
socket.setReceiveBufferSize(args[0].toInteger());
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("timeout"))
public Memory setSoTimeout(Environment env, Memory... args) throws SocketException {
socket.setSoTimeout(args[0].toInteger());
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("position"))
public Memory seek(Environment env, Memory... args){
if (memoryStream != null){
if (!memoryStream.seek(args[0].toInteger()))
env.exception(WrapIOException.class, "Cannot seek to %s", args[0].toInteger());
this.position = args[0].toInteger();
} else {
env.exception(WrapIOException.class, "Cannot seek in input/output stream");
}
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("status"))
public static Memory halt(Environment env, Memory... args) {
System.exit(args[0].toInteger());
return Memory.NULL;
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg("data"))
public Memory sendUrgentData(Environment env, Memory... args) throws IOException {
socket.sendUrgentData(args[0].toInteger());
return Memory.NULL;
}
}
代码示例来源:origin: jphp-group/jphp
@Signature(@Arg(value = "group", optional = @Reflection.Optional("null")))
public Memory end(Environment env, Memory... args) {
if (args[0].isNull())
return LongMemory.valueOf(matcher.end());
else
return LongMemory.valueOf(matcher.end(args[0].toInteger()));
}
代码示例来源:origin: jphp-group/jphp
@Override
public Memory write(Environment env, Memory... args) throws IOException {
int len = args[1].toInteger();
byte[] bytes = args[0].getBinaryBytes(env.getDefaultCharset());
len = len == 0 || len > bytes.length ? bytes.length : len;
getOutputStream().write(bytes, 0, len);
return LongMemory.valueOf(len);
}
代码示例来源:origin: jphp-group/jphp
@Signature({@Arg("value"), @Arg(value = "length", optional = @Optional("NULL"))})
public Memory write(Environment env, Memory... args){
int len = args[1].toInteger();
byte[] bytes = args[0].getBinaryBytes(env.getDefaultCharset());
try {
accessFile.write(bytes, 0, len == 0 ? bytes.length : len);
return LongMemory.valueOf(len == 0 ? bytes.length : len);
} catch (IOException e) {
env.exception(WrapIOException.class, e.getMessage());
}
return Memory.FALSE;
}
代码示例来源:origin: jphp-group/jphp
@FastMethod
@Signature(@Arg("code"))
public static Memory of(Environment env, Memory... args) {
return StringMemory.valueOf((char) (args[0].toInteger()));
}
代码示例来源:origin: jphp-group/jphp
@Override
public Memory valueOfIndex(TraceInfo trace, String index) {
int _index = -1;
Memory tmp = StringMemory.toLong(index);
if (tmp != null)
_index = tmp.toInteger();
if (_index >= 0 && _index < buffer.length())
return getChar(buffer.charAt(_index));
else
return CONST_EMPTY_STRING;
}
代码示例来源:origin: jphp-group/jphp
@FastMethod
@Signature({
@Arg("string"),
@Arg("search"),
@Arg(value = "fromIndex", optional = @Optional("NULL"))
})
public static Memory lastPosIgnoreCase(Environment env, Memory... args) {
String string = args[0].toString();
int from = args[2].isNull() ? string.length() : args[2].toInteger();
return LongMemory.valueOf(StringUtils.lastIndexOfIgnoreCase(string, args[1].toString(), from));
}
代码示例来源:origin: jphp-group/jphp
@Signature({
@Arg("sourceLine"),
})
public Memory getCompiledLine(Environment env, Memory... args) {
int sourceLine = getWrappedObject().getCompiledLine(args[0].toInteger());
return LongMemory.valueOf(sourceLine);
}
代码示例来源:origin: jphp-group/jphp
@Override
public Memory refOfIndex(TraceInfo trace, String index) {
needArray();
int _index = -1;
Memory tmp = StringMemory.toLong(index);
if (tmp != null)
_index = tmp.toInteger();
switch (getValue().type){
case STRING: return CharMemory.valueOf(this, (StringMemory)this.getValue(), _index);
default: return getValue().refOfIndex(trace, index);
}
}
代码示例来源:origin: jphp-group/jphp
@Override
public CountOptions convert(Environment env, TraceInfo trace, Memory arg) throws Throwable {
if (arg.isNull()) return null;
ArrayMemory arr = arg.toValue(ArrayMemory.class);
CountOptions options = new CountOptions();
if (arr.containsKey("skip")) options.skip(arg.valueOfIndex("skip").toInteger());
if (arr.containsKey("limit")) options.limit(arg.valueOfIndex("limit").toInteger());
if (arr.containsKey("maxTime")) {
options.maxTime(WrapTimer.parsePeriod(arg.valueOfIndex("maxTime").toString()), TimeUnit.MILLISECONDS);
}
return options;
}
内容来源于网络,如有侵权,请联系作者删除!