本文整理匯總了Java中com.sandwich.util.io.FileMonitor類的典型用法代碼示例。如果您正苦於以下問題:Java FileMonitor類的具體用法?Java FileMonitor怎麽用?Java FileMonitor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FileMonitor類屬於com.sandwich.util.io包,在下文中一共展示了FileMonitor類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFileMonitor
import com.sandwich.util.io.FileMonitor; //導入依賴的package包/類
private static FileMonitor getFileMonitor() {
try{
return FileMonitorFactory.getInstance(new File(DirectoryManager.getMainDir()), new File(DirectoryManager.getDataFile()));
}catch(RuntimeException x){
if(x.getCause() instanceof UTFDataFormatException){
ApplicationUtils.getPresenter().displayError("Issue loading file system hashes, please rerun run.bat or run.sh with the -clear switch to reset.");
System.exit(4);
}
throw x;
}
}
示例2: main
import com.sandwich.util.io.FileMonitor; //導入依賴的package包/類
public static void main(final String... args) throws Throwable {
Map<ArgumentType, CommandLineArgument> argsMap = new CommandLineArgumentBuilder(args);
if(argsMap.containsKey(ArgumentType.RUN_KOANS)){
new Thread(new Runnable(){
public void run() {
do{
try {
char c = (char)System.in.read();
if(Character.toUpperCase(c) ==
Character.toUpperCase(ApplicationSettings.getExitChar())){
FileMonitorFactory.closeAll();
System.exit(0);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}while(true);
}
}).start();
FileMonitor monitor = FileMonitorFactory.getInstance(
new File(DirectoryManager.getProdMainDir()),
new File(DirectoryManager.getDataFile()));
if(ApplicationUtils.isFirstTimeAppHasBeenRun()){
monitor.writeChanges();
}
monitor.addFileSavedListener(new KoanFileCompileAndRunListener(argsMap));
}
new CommandLineArgumentRunner(argsMap).run();
if(ApplicationSettings.isDebug()){
StringBuilder argsBuilder = new StringBuilder();
int argNumber = 0;
for(String arg : args){
argsBuilder.append("Argument number "+String.valueOf(++argNumber)+": '"+arg+"'");
}
ApplicationUtils.getPresenter().displayMessage(argsBuilder.toString());
}
}
示例3: KoanClassLoader
import com.sandwich.util.io.FileMonitor; //導入依賴的package包/類
private KoanClassLoader(String binDir, String sourceDir,
String[] classPath, ClassLoader parent,
long timeout, FileMonitor fileMonitor) {
super(binDir, sourceDir, classPath, parent, timeout);
this.fileMonitor = fileMonitor;
}
示例4: main
import com.sandwich.util.io.FileMonitor; //導入依賴的package包/類
public static void main(final String... args) throws Throwable {
Map<ArgumentType, CommandLineArgument> argsMap = new CommandLineArgumentBuilder(
args);
if (argsMap.containsKey(ArgumentType.RUN_KOANS)) {
if (ApplicationSettings.isInteractive()) {
new Thread(new Runnable() {
public void run() {
do {
try {
char c = (char) System.in.read();
char exitChar = ApplicationSettings.getExitChar();
if (Character.toUpperCase(c) == Character.toUpperCase(exitChar)) {
exit(0);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} while (true);
}
}).start();
FileMonitor monitor = FileMonitorFactory.getInstance(new File(
DirectoryManager.getProdMainDir()), new File(
DirectoryManager.getDataFile()));
if (ApplicationUtils.isFirstTimeAppHasBeenRun()) {
monitor.writeChanges();
}
monitor.addFileSavedListener(new KoanFileCompileAndRunListener(argsMap));
}
}
new CommandLineArgumentRunner(argsMap).run();
if (ApplicationSettings.isDebug()) {
StringBuilder argsBuilder = new StringBuilder();
int argNumber = 0;
for (String arg : args) {
argsBuilder.append("Argument number "
+ String.valueOf(++argNumber) + ": '" + arg + "'");
}
ApplicationUtils.getPresenter().displayMessage(
argsBuilder.toString());
}
}