|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.CoreSystem
public class CoreSystem
The CoreSystem class contains useful platform-specific methods. The class cannot be instantiated.
Method Summary | |
---|---|
static boolean[] |
arraycopy(boolean[] src)
Returns a copy of the specified array, or null if the array is null. |
static byte[] |
arraycopy(byte[] src)
Returns a copy of the specified array, or null if the array is null. |
static char[] |
arraycopy(char[] src)
Returns a copy of the specified array, or null if the array is null. |
static double[] |
arraycopy(double[] src)
Returns a copy of the specified array, or null if the array is null. |
static float[] |
arraycopy(float[] src)
Returns a copy of the specified array, or null if the array is null. |
static int[] |
arraycopy(int[] src)
Returns a copy of the specified array, or null if the array is null. |
static long[] |
arraycopy(long[] src)
Returns a copy of the specified array, or null if the array is null. |
static Object[] |
arraycopy(Object[] src)
Returns a copy of the specified array, or null if the array is null. |
static short[] |
arraycopy(short[] src)
Returns a copy of the specified array, or null if the array is null. |
static void |
clearLog()
|
static void |
clearTalkBackFields()
|
static String |
getAppProperty(String name)
Gets a named property for this application instance. |
static URL |
getBaseURL()
|
static String |
getBrowserName()
Returns the name of the web browser, or null if the browser name could not be determined. |
static String |
getBrowserVersion()
Returns the version of the web browser, or null if the browser version could not be determined. |
static String |
getClipboardText()
Returns the text currently in the clipboard. |
static int |
getDefaultBackgroundColor()
Gets the default background color. |
static int |
getDefaultForegroundColor()
Gets the default foreground color. |
static String |
getJavaProperty(String name)
Gets a Java system property. |
static String |
getLocaleCountry()
|
static String |
getLocaleLanguage()
|
static String |
getLogText()
|
static int |
getMaxSimultaneousSounds()
Gets the maximum number of sounds that can be played simultaneously. |
static int |
getNumSoundsPlaying()
Gets the number of sounds currently playing in the sound engine. |
static pulpcore.platform.Platform |
getPlatform()
Used internally by PulpCore - most apps will not need to access the Platform instance. |
static double |
getSoundVolume()
Gets the master sound volume mute setting for this application. |
static String |
getTalkBackField(String name)
Gets a named TalkBack field. |
static pulpcore.platform.AppContext |
getThisAppContext()
Used internally by PulpCore - most apps will not need to access the AppContext instance. |
static long |
getTimeMicros()
Returns the current value of the system timer in microseconds. |
static long |
getTimeMillis()
Returns the current value of the system timer in milliseconds. |
static byte[] |
getUserData(String key)
Attempts to get persistant user data from the local machine. |
static void |
init(pulpcore.platform.Platform platform)
|
static boolean |
isBrowserHosted()
Returns true if this platform is hosted in a browser (Applets). |
static boolean |
isConsoleOutputEnabled()
|
static boolean |
isJava13orNewer()
Returns true if Java 1.3 or newer is in use. |
static boolean |
isJava14orNewer()
Returns true if Java 1.4 or newer is in use. |
static boolean |
isJava15orNewer()
Returns true if Java 1.5 or newer is in use. |
static boolean |
isJava16orNewer()
Returns true if Java 1.6 or newer is in use. |
static boolean |
isJava16u10orNewer()
Returns true if Java 1.6 update 10 or newer is in use. |
static boolean |
isJava17orNewer()
Returns true if Java 1.7 or newer is in use. |
static boolean |
isMacOSX()
Returns true if the current operating system is any version of Mac OS X. |
static boolean |
isMacOSXLeopardOrNewer()
Returns true if the current operating system is Mac OS X Leopard (10.5) or newer. |
static boolean |
isMute()
Gets the audio mute setting for this application. |
static boolean |
isNativeClipboard()
Checks if the platform has access to the native operating system clipboard. |
static boolean |
isSoundEngineAvailable()
Returns true if the user's system can play sound. |
static boolean |
isValidHost(String[] validHosts)
Determines if this app is running from one of the specified hosts. |
static boolean |
isWindows()
Returns true if the current operating system is any version of Windows. |
static boolean |
isWindowsXPorNewer()
Returns true if the current operating system is Windows XP (5.1) or newer. |
static void |
print(boolean b)
Prints the string representation of a boolean to the log. |
static void |
print(double n)
Prints the string representation of a double to the log. |
static void |
print(float n)
Prints the string representation of a float to the log. |
static void |
print(int n)
Prints the string representation of an integer to the log. |
static void |
print(Object object)
Prints a the string representation of an object to the log. |
static void |
print(String statement)
Prints a line of text to the log. |
static void |
print(String statement,
Throwable t)
Prints a line of text and a Throwable's stack trace to the log. |
static void |
printMemory(String statement)
Prints the amount of current memory usage and the change in memory usage since the last call to this method. |
static void |
putUserData(String key,
byte[] data)
Attempts to store persistant user data to the local machine. |
static void |
removeUserData(String key)
Attempts to remove persistant user data from the local machine. |
static void |
setClipboardText(String text)
Sets the text in the clipboard. |
static void |
setConsoleOutputEnabled(boolean consoleOut)
|
static void |
setMute(boolean mute)
Sets the audio mute setting for this application. |
static void |
setSoundVolume(double volume)
Sets the master sound volume mute setting for this application. |
static void |
setTalkBackField(String name,
String value)
Sets a new TalkBack field. |
static void |
setTalkBackField(String name,
Throwable t)
|
static void |
showDocument(String url)
|
static void |
showDocument(String url,
String target)
|
static Upload |
uploadTalkBackFields(String talkbackPath)
Uploads talkback data to an external URL using the POST (multipart form) method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void init(pulpcore.platform.Platform platform)
public static String getJavaProperty(String name)
public static pulpcore.platform.Platform getPlatform()
public static pulpcore.platform.AppContext getThisAppContext()
public static final boolean isJava13orNewer()
public static final boolean isJava14orNewer()
public static final boolean isJava15orNewer()
public static final boolean isJava16orNewer()
public static final boolean isJava16u10orNewer()
public static final boolean isJava17orNewer()
public static final boolean isMacOSX()
public static final boolean isMacOSXLeopardOrNewer()
public static final boolean isWindows()
public static final boolean isWindowsXPorNewer()
public static boolean[] arraycopy(boolean[] src)
null
if the array is null.
public static byte[] arraycopy(byte[] src)
null
if the array is null.
public static short[] arraycopy(short[] src)
null
if the array is null.
public static char[] arraycopy(char[] src)
null
if the array is null.
public static int[] arraycopy(int[] src)
null
if the array is null.
public static long[] arraycopy(long[] src)
null
if the array is null.
public static float[] arraycopy(float[] src)
null
if the array is null.
public static double[] arraycopy(double[] src)
null
if the array is null.
public static Object[] arraycopy(Object[] src)
null
if the array is null.
public static int getDefaultBackgroundColor()
public static int getDefaultForegroundColor()
public static String getAppProperty(String name)
For Applets, the named properties are the applet parameters.
public static String getTalkBackField(String name)
public static void setTalkBackField(String name, String value)
public static void setTalkBackField(String name, Throwable t)
public static void clearTalkBackFields()
public static Upload uploadTalkBackFields(String talkbackPath)
The upload starts immediately. Use Upload.isCompleted()
to check if the upload is
finished.
talkbackPath
- the path on the applet's server.
public static boolean isValidHost(String[] validHosts)
public static void setConsoleOutputEnabled(boolean consoleOut)
public static boolean isConsoleOutputEnabled()
public static String getLogText()
public static void clearLog()
public static void print(Object object)
public static void print(boolean b)
public static void print(int n)
public static void print(float n)
public static void print(double n)
public static void print(String statement)
public static void print(String statement, Throwable t)
public static void printMemory(String statement)
public static void putUserData(String key, byte[] data)
For applets, each key is stored in a Base64-encoded cookie. The user's web browser must have LiveConnect, JavaScript, and cookies enabled. Web browsers may have the following limitations for cookies (according to RFC 2109 section 6.3):
Cookies may "expire" (become unaccessable) after an amount of time or may be deleted at any time by the browser.
Base64 encoding increases the data size by 33%. In summary, for Applets, try to use as few keys as possible, and keep the data length to a minimum.
Example: CoreSystem.putUserData("MyGame", data);
getUserData(String)
,
removeUserData(String)
public static byte[] getUserData(String key)
putUserData(String, byte[])
,
removeUserData(String)
public static void removeUserData(String key)
putUserData(String, byte[])
,
getUserData(String)
public static URL getBaseURL()
public static String getLocaleLanguage()
public static String getLocaleCountry()
public static void showDocument(String url)
public static void showDocument(String url, String target)
public static long getTimeMillis()
public static long getTimeMicros()
public static boolean isNativeClipboard()
public static String getClipboardText()
public static void setClipboardText(String text)
public static boolean isBrowserHosted()
public static String getBrowserName()
public static String getBrowserVersion()
public static boolean isMute()
public static void setMute(boolean mute)
Sound.play()
.
Due to buffering, if any sounds are playing when this setting is changed, there may be a slight delay before the new setting takes affect on those playing sounds.
mute
- true to mute the application, false otherwisepublic static double getSoundVolume()
public static void setSoundVolume(double volume)
Sound.play()
.
Due to buffering, if any sounds are playing when this setting is changed, there may be a slight delay before the new setting takes affect on those playing sounds.
volume
- the master sound volume, from 0 (silent) to 1 (full).public static boolean isSoundEngineAvailable()
As of PulpCore 0.11.4, the sound engine is loaded asynchronously. While the engine is loading, this method returns true, but may later return false if the initialization fails.
public static int getNumSoundsPlaying()
public static int getMaxSimultaneousSounds()
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |