Android APIs
public final class

Os

extends Object
java.lang.Object
   ↳ android.system.Os

Class Overview

Access to low-level system functionality. Most of these are system calls. Most users will want to use higher-level APIs where available, but this class provides access to the underlying primitives used to implement the higher-level APIs.

The corresponding constants can be found in OsConstants.

Summary

Public Methods
static FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress)
static boolean access(String path, int mode)
static void bind(FileDescriptor fd, InetAddress address, int port)
See bind(2).
static void chmod(String path, int mode)
static void chown(String path, int uid, int gid)
static void close(FileDescriptor fd)
static void connect(FileDescriptor fd, InetAddress address, int port)
static FileDescriptor dup(FileDescriptor oldFd)
See dup(2).
static FileDescriptor dup2(FileDescriptor oldFd, int newFd)
See dup2(2).
static String[] environ()
static void execv(String filename, String[] argv)
static void execve(String filename, String[] argv, String[] envp)
static void fchmod(FileDescriptor fd, int mode)
static void fchown(FileDescriptor fd, int uid, int gid)
static void fdatasync(FileDescriptor fd)
static StructStat fstat(FileDescriptor fd)
static StructStatVfs fstatvfs(FileDescriptor fd)
static void fsync(FileDescriptor fd)
static void ftruncate(FileDescriptor fd, long length)
static String gai_strerror(int error)
static int getegid()
static String getenv(String name)
static int geteuid()
static int getgid()
static SocketAddress getpeername(FileDescriptor fd)
static int getpid()
static int getppid()
static SocketAddress getsockname(FileDescriptor fd)
static int gettid()
static int getuid()
static String if_indextoname(int index)
static InetAddress inet_pton(int family, String address)
static boolean isatty(FileDescriptor fd)
static void kill(int pid, int signal)
See kill(2).
static void lchown(String path, int uid, int gid)
static void link(String oldPath, String newPath)
See link(2).
static void listen(FileDescriptor fd, int backlog)
static long lseek(FileDescriptor fd, long offset, int whence)
static StructStat lstat(String path)
static void mincore(long address, long byteCount, byte[] vector)
static void mkdir(String path, int mode)
static void mkfifo(String path, int mode)
static void mlock(long address, long byteCount)
static long mmap(long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset)
See mmap(2).
static void msync(long address, long byteCount, int flags)
static void munlock(long address, long byteCount)
static void munmap(long address, long byteCount)
static FileDescriptor open(String path, int flags, int mode)
See open(2).
static FileDescriptor[] pipe()
See pipe(2).
static int poll(StructPollfd[] fds, int timeoutMs)
See poll(2).
static void posix_fallocate(FileDescriptor fd, long offset, long length)
static int prctl(int option, long arg2, long arg3, long arg4, long arg5)
static int pread(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)
static int pread(FileDescriptor fd, ByteBuffer buffer, long offset)
static int pwrite(FileDescriptor fd, ByteBuffer buffer, long offset)
static int pwrite(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)
static int read(FileDescriptor fd, ByteBuffer buffer)
See read(2).
static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)
See read(2).
static String readlink(String path)
static int readv(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)
static int recvfrom(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress)
static int recvfrom(FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress)
static void remove(String path)
static void rename(String oldPath, String newPath)
static long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount)
static int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port)
static int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port)
static void setegid(int egid)
static void setenv(String name, String value, boolean overwrite)
static void seteuid(int euid)
static void setgid(int gid)
static int setsid()
static void setuid(int uid)
static void shutdown(FileDescriptor fd, int how)
static FileDescriptor socket(int domain, int type, int protocol)
static void socketpair(int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2)
static StructStat stat(String path)
See stat(2).
static StructStatVfs statvfs(String path)
static String strerror(int errno)
static String strsignal(int signal)
static void symlink(String oldPath, String newPath)
static long sysconf(int name)
static void tcdrain(FileDescriptor fd)
static void tcsendbreak(FileDescriptor fd, int duration)
static int umask(int mask)
static StructUtsname uname()
static void unsetenv(String name)
static int waitpid(int pid, MutableInt status, int options)
static int write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)
static int write(FileDescriptor fd, ByteBuffer buffer)
static int writev(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static FileDescriptor accept (FileDescriptor fd, InetSocketAddress peerAddress)

public static boolean access (String path, int mode)

public static void bind (FileDescriptor fd, InetAddress address, int port)

public static void chmod (String path, int mode)

See chmod(2).

public static void chown (String path, int uid, int gid)

See chown(2).

public static void close (FileDescriptor fd)

See close(2).

public static void connect (FileDescriptor fd, InetAddress address, int port)

public static FileDescriptor dup (FileDescriptor oldFd)

See dup(2).

public static FileDescriptor dup2 (FileDescriptor oldFd, int newFd)

See dup2(2).

public static String[] environ ()

public static void execv (String filename, String[] argv)

See execv(2).

public static void execve (String filename, String[] argv, String[] envp)

public static void fchmod (FileDescriptor fd, int mode)

public static void fchown (FileDescriptor fd, int uid, int gid)

public static void fdatasync (FileDescriptor fd)

public static StructStat fstat (FileDescriptor fd)

See fstat(2).

public static StructStatVfs fstatvfs (FileDescriptor fd)

public static void fsync (FileDescriptor fd)

See fsync(2).

public static void ftruncate (FileDescriptor fd, long length)

public static String gai_strerror (int error)

public static int getegid ()

public static String getenv (String name)

See getenv(3).

public static int geteuid ()

public static int getgid ()

See getgid(2).

public static SocketAddress getpeername (FileDescriptor fd)

public static int getpid ()

See getpid(2).

public static int getppid ()

public static SocketAddress getsockname (FileDescriptor fd)

public static int gettid ()

See gettid(2).

public static int getuid ()

See getuid(2).

public static String if_indextoname (int index)

public static InetAddress inet_pton (int family, String address)

public static boolean isatty (FileDescriptor fd)

See isatty(3).

public static void kill (int pid, int signal)

See kill(2).

public static void lchown (String path, int uid, int gid)

public static void link (String oldPath, String newPath)

See link(2).

public static void listen (FileDescriptor fd, int backlog)

public static long lseek (FileDescriptor fd, long offset, int whence)

See lseek(2).

public static StructStat lstat (String path)

See lstat(2).

public static void mincore (long address, long byteCount, byte[] vector)

public static void mkdir (String path, int mode)

See mkdir(2).

public static void mkfifo (String path, int mode)

public static void mlock (long address, long byteCount)

See mlock(2).

public static long mmap (long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset)

See mmap(2).

public static void msync (long address, long byteCount, int flags)

See msync(2).

public static void munlock (long address, long byteCount)

public static void munmap (long address, long byteCount)

public static FileDescriptor open (String path, int flags, int mode)

See open(2).

public static FileDescriptor[] pipe ()

See pipe(2).

public static int poll (StructPollfd[] fds, int timeoutMs)

See poll(2).

public static void posix_fallocate (FileDescriptor fd, long offset, long length)

public static int prctl (int option, long arg2, long arg3, long arg4, long arg5)

See prctl(2).

public static int pread (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)

public static int pread (FileDescriptor fd, ByteBuffer buffer, long offset)

public static int pwrite (FileDescriptor fd, ByteBuffer buffer, long offset)

public static int pwrite (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)

public static int read (FileDescriptor fd, ByteBuffer buffer)

public static int read (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)

public static String readlink (String path)

public static int readv (FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)

public static int recvfrom (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress)

public static int recvfrom (FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress)

public static void remove (String path)

public static void rename (String oldPath, String newPath)

public static long sendfile (FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount)

public static int sendto (FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port)

public static int sendto (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port)

public static void setegid (int egid)

public static void setenv (String name, String value, boolean overwrite)

public static void seteuid (int euid)

public static void setgid (int gid)

public static int setsid ()

public static void setuid (int uid)

public static void shutdown (FileDescriptor fd, int how)

public static FileDescriptor socket (int domain, int type, int protocol)

public static void socketpair (int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2)

public static StructStat stat (String path)

See stat(2).

public static StructStatVfs statvfs (String path)

public static String strerror (int errno)

public static String strsignal (int signal)

public static void symlink (String oldPath, String newPath)

public static long sysconf (int name)

public static void tcdrain (FileDescriptor fd)

public static void tcsendbreak (FileDescriptor fd, int duration)

public static int umask (int mask)

See umask(2).

public static StructUtsname uname ()

See uname(2).

public static void unsetenv (String name)

public static int waitpid (int pid, MutableInt status, int options)

public static int write (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)

public static int write (FileDescriptor fd, ByteBuffer buffer)

public static int writev (FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)