org.robovm.rt.bro.ptr.BytePtr.toBytePtrAsciiZ()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(56)

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

BytePtr.toBytePtrAsciiZ介绍

[英]Converts the specified String to a NUL-terminated C string of ASCII characters. Non ASCII characters will be replaced with '?' in the result. The memory will be allocated on the GCed heaped. This method is more efficient than using #toStringZ(Charset) with ASCII as Charset.
[中]将指定的字符串转换为ASCII字符的以NUL结尾的C字符串。非ASCII字符将替换为“?”结果呢。内存将在GCed堆上分配。这种方法比使用带有ASCII字符集的#toStringZ(字符集)更有效。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Converts the specified {@link String} to a NUL-terminated C string of 
 * ASCII characters. Non ASCII characters will be replaced with '?' in the 
 * result. The memory will be allocated on the GCed heaped. This method is 
 * more efficient than using {@link #toStringZ(Charset)} with ASCII as 
 * {@link Charset}.
 * 
 * @param s the {@link String} to convert.
 * @return a {@link BytePtr} which points to the first character in the result.
 */
public static BytePtr toBytePtrAsciiZ(String s) {
  return toBytePtrAsciiZ(s, false);
}

代码示例来源:origin: robovm/robovm

public static NSValue valueOf(VoidPtr value, String type) {
  BytePtr p = type == null ? null : BytePtr.toBytePtrAsciiZ(type);
  return valueOf(value, p);
}

代码示例来源:origin: robovm/robovm

public static Selector register(String name) {
  if (name == null) {
    throw new NullPointerException("name");
  }
  synchronized (selectors) {
    Selector sel = selectors.get(name);
    if (sel == null) {
      sel = ObjCRuntime.sel_registerName(BytePtr.toBytePtrAsciiZ(name));
      if (sel == null) {
        // sel_registerName should never return nil
        throw new IllegalStateException("Objective-C failed to register selector '" + name + "'");
      }
      selectors.put(name, sel);
    }
    return sel;
  }
}

代码示例来源:origin: libgdx/libgdx

public static String getMachineString () {
  BytePtr name = BytePtr.toBytePtrAsciiZ("hw.machine");
  MachineSizedUIntPtr size = new MachineSizedUIntPtr();
  sysctlbyname(name, null, size, null, 0);
  BytePtr machine = Struct.allocate(BytePtr.class, (int) size.get());
  sysctlbyname(name, machine.as(VoidPtr.class), size, null, 0);
  return machine.toStringAsciiZ();
}

代码示例来源:origin: libgdx/libgdx

public static String getMachineString () {
  BytePtr name = BytePtr.toBytePtrAsciiZ("hw.machine");
  MachineSizedUIntPtr size = new MachineSizedUIntPtr();
  sysctlbyname(name, null, size, null, 0);
  BytePtr machine = Struct.allocate(BytePtr.class, (int) size.get());
  sysctlbyname(name, machine.as(VoidPtr.class), size, null, 0);
  return machine.toStringAsciiZ();
}

代码示例来源:origin: robovm/robovm

for (int i = 0; i < argc; i++) {
  BytePtr arg = BytePtr.toBytePtrAsciiZ(args[i]);
  argv.next(i).set(arg);

代码示例来源:origin: MobiVM/robovm

/**
 * Converts the specified {@link String} to a NUL-terminated C string of 
 * ASCII characters. Non ASCII characters will be replaced with '?' in the 
 * result. The memory will be allocated on the GCed heaped. This method is 
 * more efficient than using {@link #toStringZ(Charset)} with ASCII as 
 * {@link Charset}.
 * 
 * @param s the {@link String} to convert.
 * @return a {@link BytePtr} which points to the first character in the result.
 */
public static BytePtr toBytePtrAsciiZ(String s) {
  return toBytePtrAsciiZ(s, false);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Converts the specified {@link String} to a NUL-terminated C string of 
 * ASCII characters. Non ASCII characters will be replaced with '?' in the 
 * result. The memory will be allocated on the GCed heaped. This method is 
 * more efficient than using {@link #toStringZ(Charset)} with ASCII as 
 * {@link Charset}.
 * 
 * @param s the {@link String} to convert.
 * @return a {@link BytePtr} which points to the first character in the result.
 */
public static BytePtr toBytePtrAsciiZ(String s) {
  return toBytePtrAsciiZ(s, false);
}

代码示例来源:origin: org.robovm/robovm-rt-common

/**
 * Converts the specified {@link String} to a NUL-terminated C string of 
 * ASCII characters. Non ASCII characters will be replaced with '?' in the 
 * result. The memory will be allocated on the GCed heaped. This method is 
 * more efficient than using {@link #toStringZ(Charset)} with ASCII as 
 * {@link Charset}.
 * 
 * @param s the {@link String} to convert.
 * @return a {@link BytePtr} which points to the first character in the result.
 */
public static BytePtr toBytePtrAsciiZ(String s) {
  return toBytePtrAsciiZ(s, false);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Converts the specified {@link String} to a NUL-terminated C string of 
 * ASCII characters. Non ASCII characters will be replaced with '?' in the 
 * result. The memory will be allocated on the GCed heaped. This method is 
 * more efficient than using {@link #toStringZ(Charset)} with ASCII as 
 * {@link Charset}.
 * 
 * @param s the {@link String} to convert.
 * @return a {@link BytePtr} which points to the first character in the result.
 */
public static BytePtr toBytePtrAsciiZ(String s) {
  return toBytePtrAsciiZ(s, false);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Converts the specified {@link String} to a NUL-terminated C string of 
 * ASCII characters. Non ASCII characters will be replaced with '?' in the 
 * result. The memory will be allocated on the GCed heaped. This method is 
 * more efficient than using {@link #toStringZ(Charset)} with ASCII as 
 * {@link Charset}.
 * 
 * @param s the {@link String} to convert.
 * @return a {@link BytePtr} which points to the first character in the result.
 */
public static BytePtr toBytePtrAsciiZ(String s) {
  return toBytePtrAsciiZ(s, false);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-cocoatouch

public static NSValue valueOf(VoidPtr value, String type) {
  BytePtr p = type == null ? null : BytePtr.toBytePtrAsciiZ(type);
  return valueOf(value, p);
}

代码示例来源:origin: com.gluonhq/robovm-cocoatouch

public static NSValue valueOf(VoidPtr value, String type) {
  BytePtr p = type == null ? null : BytePtr.toBytePtrAsciiZ(type);
  return valueOf(value, p);
}

代码示例来源:origin: com.gluonhq/robovm-objc

public static Selector register(String name) {
  if (name == null) {
    throw new NullPointerException("name");
  }
  synchronized (selectors) {
    Selector sel = selectors.get(name);
    if (sel == null) {
      sel = ObjCRuntime.sel_registerName(BytePtr.toBytePtrAsciiZ(name));
      if (sel == null) {
        // sel_registerName should never return nil
        throw new IllegalStateException("Objective-C failed to register selector '" + name + "'");
      }
      selectors.put(name, sel);
    }
    return sel;
  }
}

代码示例来源:origin: threerings/playn

public void glShaderSource(int shader, String source) {
 BytePtr.BytePtrPtr sources = Struct.allocate(BytePtr.BytePtrPtr.class, 1);
 sources.next(0).set(BytePtr.toBytePtrAsciiZ(source));
 OpenGLES.glShaderSource(shader, 1, sources, null);
}
public void glStencilFunc(int func, int ref, int mask) {

代码示例来源:origin: playn/playn

@Override public void glShaderSource(int shader, String source) {
 BytePtr.BytePtrPtr sources = Struct.allocate(BytePtr.BytePtrPtr.class, 1);
 sources.next(0).set(BytePtr.toBytePtrAsciiZ(source));
 OpenGLES.glShaderSource(shader, 1, sources, null);
}
@Override public void glStencilFunc(int func, int ref, int mask) {

代码示例来源:origin: com.gluonhq/robovm-objc

private Wrapper(Method method, boolean validate) {
  if (validate && method.getAnnotation(Callback.class) == null) {
    throw new IllegalArgumentException("Method " + method 
        + " is not a @Callback method");
  }
  TypeEncoding typeEncoding = method.getAnnotation(TypeEncoding.class);
  if (typeEncoding != null) {
    descriptor = new Descriptor()
        .literal_size(ObjCBlock.sizeOf())
        .copy_helper(DESCRIPTOR.copy_helper())
        .dispose_helper(DESCRIPTOR.dispose_helper())
        .signature(BytePtr.toBytePtrAsciiZ(typeEncoding.value()));
  } else {
    descriptor = DESCRIPTOR;
  }
  callbackImpl = VM.getCallbackMethodImpl(method);
  int flags = BLOCK_HAS_COPY_DISPOSE | BLOCK_HAS_SIGNATURE;
  if (ObjCRuntime.isStret(method)) {
    flags |= BLOCK_HAS_STRET;
  }
  this.flags = flags;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-robovm

public static String getMachineString () {
  BytePtr name = BytePtr.toBytePtrAsciiZ("hw.machine");
  MachineSizedUIntPtr size = new MachineSizedUIntPtr();
  sysctlbyname(name, null, size, null, 0);
  BytePtr machine = Struct.allocate(BytePtr.class, (int) size.get());
  sysctlbyname(name, machine.as(VoidPtr.class), size, null, 0);
  return machine.toStringAsciiZ();
}

代码示例来源:origin: com.gluonhq/robovm-cocoatouch

for (int i = 0; i < argc; i++) {
  BytePtr arg = BytePtr.toBytePtrAsciiZ(args[i]);
  argv.next(i).set(arg);

代码示例来源:origin: com.mobidevelop.robovm/robovm-cocoatouch

for (int i = 0; i < argc; i++) {
  BytePtr arg = BytePtr.toBytePtrAsciiZ(args[i]);
  argv.next(i).set(arg);

相关文章