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

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

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

BytePtr.toStringAsciiZ介绍

[英]Returns a String created from the NUL-terminated C string pointed to by this BytePtr. Non ASCII characters will be replaced with '?' in the result. This method is more efficient than using #toStringZ(Charset) with ASCII as Charset.
[中]返回从该BytePtr指向的以NUL结尾的C字符串创建的字符串。非ASCII字符将替换为“?”结果呢。这种方法比使用带有ASCII字符集的#toStringZ(字符集)更有效。

代码示例

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

public String getName() {
  return ObjCRuntime.sel_getName(this).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: 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: com.gluonhq/robovm-objc

public String getName() {
  return ObjCRuntime.sel_getName(this).toStringAsciiZ();
}

代码示例来源: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();
}

相关文章