public final class OS extends Object
Modifier and Type | Class and Description |
---|---|
static class |
OS.Unmapper |
Modifier and Type | Field and Description |
---|---|
static int |
SAFE_PAGE_SIZE |
static String |
TARGET
Deprecated.
|
static Exception |
TIME_LIMIT |
static String |
TMP |
static String |
USER_DIR |
static String |
USER_HOME |
Modifier and Type | Method and Description |
---|---|
static @NotNull String |
findDir(@NotNull String suffix) |
static @NotNull File |
findFile(String... path)
Search a list of directories to find a path which is the last element.
|
static String |
getHostName() |
static long |
getPidMax() |
static int |
getProcessId() |
static String |
getTarget() |
static String |
getUserName() |
static boolean |
is64Bit() |
static boolean |
isLinux() |
static boolean |
isMacOSX() |
static boolean |
isWindows()
This may or may not be the OS thread id, but should be unique across processes
|
static long |
map(@NotNull FileChannel fileChannel,
FileChannel.MapMode mode,
long start,
long size)
Map a region of a file into memory.
|
static long |
mapAlign(long offset)
Align an offset of a memory mapping in file based on OS.
|
static long |
mapAlignment()
Returns the alignment of offsets in file, from which memory mapping could start, based on
OS.
|
static @NotNull Memory |
memory() |
static long |
memoryMapped() |
static long |
pageAlign(long size)
Align the size to page boundary
|
static int |
pageSize() |
static int |
read0(FileDescriptor fd,
long address,
int len) |
static long |
spaceUsed(@NotNull String filename)
Get the space actually used by a file.
|
static void |
unmap(long address,
long size)
Unmap a region of memory.
|
static String |
userDir() |
static int |
write0(FileDescriptor fd,
long address,
int len) |
public static final String TMP
public static final String USER_DIR
public static final String USER_HOME
public static final Exception TIME_LIMIT
@Deprecated public static final String TARGET
public static final int SAFE_PAGE_SIZE
@NotNull public static @NotNull String findDir(@NotNull @NotNull String suffix) throws FileNotFoundException
FileNotFoundException
@NotNull public static @NotNull File findFile(@NotNull String... path)
path
- of directories to use if found, the last path is always appended.public static String getHostName()
public static String getUserName()
public static String getTarget()
@NotNull public static @NotNull Memory memory()
public static long pageAlign(long size)
size
- the size to alignpageSize()
public static int pageSize()
pageAlign(long)
public static long mapAlign(long offset)
offset
- to alignmapAlignment()
public static long mapAlignment()
mapAlign(long)
public static boolean is64Bit()
public static int getProcessId()
public static boolean isWindows()
public static boolean isMacOSX()
public static boolean isLinux()
public static long getPidMax()
NumberFormatException
- if ?AssertionError
- if ?public static long map(@NotNull @NotNull FileChannel fileChannel, FileChannel.MapMode mode, long start, long size) throws IOException, IllegalArgumentException
fileChannel
- to mapmode
- of accessstart
- offset within a filesize
- of region to map.IOException
- if the mapping failsIllegalArgumentException
- if the arguments are not validpublic static void unmap(long address, long size) throws IOException
address
- of the start of the mapping.size
- of the region mapped.IOException
- if the unmap fails.public static long memoryMapped()
public static long spaceUsed(@NotNull @NotNull String filename)
filename
- to get the actual size ofpublic static String userDir()
public static int read0(FileDescriptor fd, long address, int len) throws IOException
IOException
public static int write0(FileDescriptor fd, long address, int len) throws IOException
IOException
Copyright © 2021. All rights reserved.