本文整理匯總了Java中com.sandwich.util.io.FileMonitor.addFileSavedListener方法的典型用法代碼示例。如果您正苦於以下問題:Java FileMonitor.addFileSavedListener方法的具體用法?Java FileMonitor.addFileSavedListener怎麽用?Java FileMonitor.addFileSavedListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sandwich.util.io.FileMonitor
的用法示例。
在下文中一共展示了FileMonitor.addFileSavedListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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());
}
}
示例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)) {
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());
}
}