droid_wrap::java::lang

Struct System

Source
pub struct System { /* private fields */ }
Expand description

System 类包含几个有用的类字段和方法。它无法实例化。 System 类提供的功能包括标准输入、标准输出和错误输出流;访问外部定义的属性和环境变量;加载文件和库的方法;以及用于快速复制数组一部分的实用方法。

Implementations§

Source§

impl System

Source

pub fn current_time_millis() -> i64

返回当前时间(以毫秒为单位)。请注意,虽然返回值的时间单位是毫秒,但值的粒度取决于底层操作系统,可能更大。例如,许多操作系统以数十毫秒为单位测量时间。有关“计算机时间”和协调世界时 (UTC) 之间可能出现的细微差异的讨论,请参阅 Date 类的描述。 返回:当前时间与 1970 年 1 月 1 日午夜 UTC 之间的差值(以毫秒为单位)。

Source

pub fn gc()

运行垃圾收集器。调用 gc 方法表明 Java 虚拟机会努力回收未使用的对象,以便使它们当前占用的内存可供快速重用。当控制权从方法调用返回时,Java 虚拟机已尽最大努力从所有丢弃的对象中回收空间。调用 System.gc() 实际上等同于调用: Runtime.getRuntime().gc()

Source

pub fn exit(status: i32) -> Result<(), <Self as JType>::Error>

终止当前正在运行的 Java 虚拟机。该参数用作状态代码;按照惯例,非零状态代码表示异常终止。此方法调用 Runtime 类中的 exit 方法。此方法永远不会正常返回。调用 System.exit(n) 实际上等同于调用: Runtime.getRuntime().exit(n) 抛出:SecurityException – 如果存在安全管理器并且其 checkExit 方法不允许以指定状态退出。 status 退出状态。

Methods from Deref<Target = GlobalRef>§

Source

pub fn as_obj(&self) -> &JObject<'static>

Get the object from the global ref

This borrows the ref and prevents it from being dropped as long as the JObject sticks around.

Methods from Deref<Target = JObject<'static>>§

Source

pub fn as_raw(&self) -> *mut _jobject

Returns the raw JNI pointer.

Trait Implementations§

Source§

impl Debug for System

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for System

Source§

type Target = GlobalRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<&GlobalRef> for System

Source§

fn from(obj: &GlobalRef) -> Self

Converts to this type from the input type.
Source§

impl Into<GlobalRef> for &System

Source§

fn into(self) -> GlobalRef

Converts this type into the (usually inferred) input type.
Source§

impl JObjNew for System

Source§

type Fields = ()

字段类型
Source§

fn _new(this: &GlobalRef, fields: Self::Fields) -> Self

从java对象创建本地对象。 this java对象引用。
Source§

fn null() -> Self
where Self: Sized, Self::Fields: Default,

创建空对象。
Source§

impl JObjRef for System

Source§

fn java_ref(&self) -> GlobalRef

获取java对象引用。
Source§

impl JType for System

Source§

const CLASS: &'static str = "java/lang/System"

java类的名称。
Source§

const OBJECT_SIG: &'static str = "Ljava/lang/System;"

对象的签名描述。
Source§

type Error = Error

错误类型。
Source§

const DIM: u8 = 0u8

数组维度,0表示不是数组
Source§

impl PartialEq for System

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToString for System

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more

Auto Trait Implementations§

§

impl Freeze for System

§

impl RefUnwindSafe for System

§

impl Send for System

§

impl Sync for System

§

impl Unpin for System

§

impl UnwindSafe for System

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.