📄 savevariables.java
字号:
package jmathlib.toolbox.io;
import jmathlib.core.tokens.*;
import jmathlib.core.functions.ExternalFunction;
import java.io.*;
public class savevariables extends ExternalFunction
{
public OperandToken evaluate(Token[] operands)
{
if (getNArgIn(operands) > 1)
throwMathLibException("savevariables: number of arguments > 1");
String file = "." + File.separator + "variables.mlf";
if (getNArgIn(operands) == 1)
{
if (!(operands[0] instanceof CharToken))
throwMathLibException("savevariables: argument must be a string");
file = ((CharToken)operands[0]).toString();
}
getVariables().saveVariables(file);
return null;
} // end eval
}
/*
@GROUP
IO
@SYNTAX
savevariables()
savevariables("name.mlf")
@DOC
saves the variables from the current workspace into a serialized .mlf-file
@EXAMPLES
<programlisting>
savevariables()
</programlisting>
@NOTES
The variables are written as a serialized stream of java objects. Therefor the
format of the .mlf-file is java-specific. The file is also specific to the
versions of MathLib token and classes.
@SEE
loadvariables, csvread, csvwrite
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -