public abstract class OSAdapter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
OSAdapter.SerialPortListGetter
Interface to a class that can provide a list of available serial ports on the host computer.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getCachedSerialPortNames(java.lang.String deviceName)
Get the list of serial port device names, including the specified name.
|
static java.io.File |
getDirectoryFromCache(java.lang.String cacheId)
Get a File representing a remembered directory for a particular type of file operation.
|
static OSAdapter.SerialPortListGetter |
getSerialPortListGetter()
Get the existing SerialPortListGetter.
|
static java.lang.String[] |
getSerialPortNames(java.lang.String currentDevName)
Obtain the list of unused serial ports on this system.
|
static boolean |
isWindows()
Test if the host operating system is Microsoft Windows.
|
static void |
markFileAsRandom(java.io.RandomAccessFile raf)
If O/S and available libraries allow it, mark open file as only randomly accessed.
|
static void |
markStreamAsSequential(java.io.FileInputStream is)
If O/S and available libraries allow it, mark open file as only sequentially accessed.
|
static void |
markStreamAsSequential(java.io.FileOutputStream os)
If O/S and available libraries allow it, mark open file as only sequentially accessed.
|
static void |
openURL(java.lang.String url)
Launch O/S-specific browser to view a particular URL.
|
static void |
purgeSerialPortCache()
Purge the cached list of serial port device names, so the next query will have to
build the list from scratch.
|
static void |
putDirectoryToCache(java.lang.String cacheId,
java.io.File dir)
remember the last directory used for a type of file operation.
|
static long |
releaseOldPages(java.io.FileInputStream is,
long startForFlush)
If O/S and available libraries allow it, mark every page prior to the current seek
position as no longer needed.
|
static long |
releaseOldPages(java.io.FileOutputStream os,
long startForFlush)
If O/S and available libraries allow it, mark every page prior to the current seek
position as no longer needed.
|
static void |
releaseOldPages(java.io.RandomAccessFile raf)
If O/S and available libraries allow it, mark every page in the RandomAccessFile as no longer needed.
|
static void |
releaseOldPages(java.io.RandomAccessFile raf,
long startPos,
long endPos)
If O/S and available libraries allow it, mark every page in the specified range in
the RandomAccessFile as no longer needed.
|
static void |
sendEmail(java.lang.String emailAddr)
Launch O/S-specific email client to compose an outgoing email.
|
static void |
setSerialPortListGetter(OSAdapter.SerialPortListGetter serialPortListGetter)
Replace the SerialPortListGetter with a different one if the serial port library
is changed by a plugin.
|
public static OSAdapter.SerialPortListGetter getSerialPortListGetter()
public static void setSerialPortListGetter(OSAdapter.SerialPortListGetter serialPortListGetter)
serialPortListGetter
- SerialPortListGetter instancepublic static java.lang.String[] getSerialPortNames(java.lang.String currentDevName)
currentDevName
- String of an already-busy device name to add to list, or null for no additional namepublic static java.lang.String[] getCachedSerialPortNames(java.lang.String deviceName)
deviceName
- device name to include (in case the device is already open)public static void purgeSerialPortCache()
public static boolean isWindows()
public static void openURL(java.lang.String url)
url
- String representation of URL to viewpublic static void sendEmail(java.lang.String emailAddr) throws java.lang.Throwable
emailAddr
- String representation of recipient email addressjava.lang.Throwable
- if email client could not be launched for any reasonpublic static java.io.File getDirectoryFromCache(java.lang.String cacheId)
cacheId
- String name of file operation (such as log files, or tile files)public static void putDirectoryToCache(java.lang.String cacheId, java.io.File dir)
cacheId
- String name of file typedir
- File pointing to the last directory used for those filespublic static void markStreamAsSequential(java.io.FileInputStream is)
is
- FileInputStream whose file descriptor will be accessedpublic static long releaseOldPages(java.io.FileInputStream is, long startForFlush)
is
- FileInputStream whose file descriptor will be accessedstartForFlush
- file position where no-longer-needed file system cache pages should start being releasedpublic static long releaseOldPages(java.io.FileOutputStream os, long startForFlush)
os
- FileOutputStream whose file descriptor will be accessedstartForFlush
- file position where no-longer-needed file system cache pages should start being releasedpublic static void releaseOldPages(java.io.RandomAccessFile raf)
raf
- RandomAccessFile whose file descriptor will be accessedMultiBufferedRandomAccessFile.getRandomAccessFile()
public static void releaseOldPages(java.io.RandomAccessFile raf, long startPos, long endPos)
raf
- RandomAccessFile whose file descriptor will be accessedstartPos
- starting offset in file to releaseendPos
- ending offset in file to releaseMultiBufferedRandomAccessFile.getRandomAccessFile()
public static void markStreamAsSequential(java.io.FileOutputStream os)
os
- FileOutputStream whose file descriptor will be accessedpublic static void markFileAsRandom(java.io.RandomAccessFile raf)
raf
- RandomAccessFile whose file descriptor will be accessed