public final class SFIToolkit extends Object
Modifier and Type | Field and Description |
---|---|
static int |
RC_BREAK |
static int |
RC_GENERAL_ERROR |
static int |
RC_GENERAL_EXCEPTION |
static int |
RC_SYNTAX_ERROR |
Modifier and Type | Method and Description |
---|---|
static void |
callGC()
Call the Java garbage collector. Calling this method should
generally be avoided.
|
static void |
display(String s)
Output a string to the Stata Results window.
|
static void |
display(String s,
boolean asis)
Output a string to the Stata Results window.
|
static void |
displayln(String s)
Output a string to the Stata Results window and automatically add a line
terminator at the end.
|
static int |
error(int rc)
Deprecated.
Use
SFIToolkit.errorMsg(int) instead. This function will
cease to exist in Stata 17. |
static void |
error(String s)
Output a string to the Stata Results window as an error.
|
static void |
error(String s,
boolean asis)
Output a string to the Stata Results window as an error.
|
static boolean |
errorDebug(String s)
Output a string to the Stata Results window as an error if set debug
on is enabled.
|
static boolean |
errorDebug(String s,
boolean asis)
Output a string to the Stata Results window as an error if set debug
on is enabled.
|
static void |
errorln(String s)
Output a string to the Stata Results window and automatically add a line
terminator at the end.
|
static int |
errorMsg(int rc)
Output the standard Stata error message associated with return code
rc to the Stata Results window.
|
static int |
executeCommand(String command,
boolean echo)
Execute a Stata command.
|
static String |
formatValue(double val,
String format)
Format a value using a Stata format.
|
static double |
getCallerVersion()
Get the version number of the calling program.
|
static String |
getTempFile()
Get a valid Stata temporary filename.
|
static String |
getTempName()
Get a valid Stata temporary name.
|
static String |
getWorkingDir()
Get the current Stata working directory.
|
static boolean |
isValidName(String s)
Check if a
String is a valid Stata name. |
static boolean |
isValidVariableName(String s)
Check if a
String is a valid Stata variable name. |
static void |
loadStataProxySettings()
Apply Stata's proxy settings to Java.
|
static int |
pollnow()
Request that Stata poll its GUI immediately.
|
static int |
pollstd()
Request that Stata poll its GUI at the standard interval.
|
static String |
processTildePath(String path)
Stata utility to convert a path beginning with a tilde to a user's home
directory.
|
static File |
resolvePath(String path)
Resolve a path to a
File ; the path may be relative to
Stata's current working directory, a path beginning with a tilde, or an
absolute path. |
static String |
stackTraceToString(Exception e)
|
public static final int RC_BREAK
public static final int RC_GENERAL_ERROR
public static final int RC_GENERAL_EXCEPTION
public static final int RC_SYNTAX_ERROR
@Synchronized public static void callGC()
@SynchronizedOnMain public static void display(String s)
s
- The string to output.@SynchronizedOnMain public static void display(String s, boolean asis)
s
- The string to output.asis
- When true, the string is printed without using the Stata SMCL
interpreter.@SynchronizedOnMain public static void displayln(String s)
s
- The string to output.@SynchronizedOnMain public static int error(int rc)
SFIToolkit.errorMsg(int)
instead. This function will
cease to exist in Stata 17.rc
- The return code for the error.@SynchronizedOnMain public static void error(String s)
s
- The string to output.@SynchronizedOnMain public static void error(String s, boolean asis)
s
- The string to output.asis
- When true, the string is printed without using the Stata SMCL
interpreter.@SynchronizedOnMain public static boolean errorDebug(String s)
s
- The string to output.@SynchronizedOnMain public static boolean errorDebug(String s, boolean asis)
s
- The string to output.asis
- When true, the string is printed without using the Stata SMCL
interpreter.@SynchronizedOnMain public static void errorln(String s)
s
- The string to output.@SynchronizedOnMain public static int errorMsg(int rc)
rc
- The return code for the error.@SynchronizedOnMain public static int executeCommand(String command, boolean echo)
command
- The command to execute.echo
- Echo the command.@ThreadSafe public static String formatValue(double val, String format)
@Synchronized public static double getCallerVersion()
@Synchronized public static String getTempFile()
@Synchronized public static String getTempName()
@Synchronized public static String getWorkingDir()
@ThreadSafe public static boolean isValidName(String s)
String
is a valid Stata name.s
- Name to test.String
represents a valid Stata name.@ThreadSafe public static boolean isValidVariableName(String s)
String
is a valid Stata variable name.s
- Name to test.String
represents a valid Stata variable
name.public static void loadStataProxySettings()
@ThreadSafe public static int pollnow()
pollstd
should be used instead.@ThreadSafe public static int pollstd()
@Synchronized public static String processTildePath(String path)
path
- Path to process.@Synchronized public static File resolvePath(String path) throws InvalidPathException
File
; the path may be relative to
Stata's current working directory, a path beginning with a tilde, or an
absolute path.path
- Path to process.File
.InvalidPathException
@ThreadSafe public static String stackTraceToString(Exception e)
e
- ExceptionString
representation of the stack trace.