Java Code Examples for cn.hutool.core.io.FileUtil#touch()

The following examples show how to use cn.hutool.core.io.FileUtil#touch() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageListener.java    From MooTool with MIT License 6 votes vote down vote up
/**
 * save for manual
 */
private static void saveImage() {
    if (StringUtils.isEmpty(selectedName)) {
        selectedName = "未命名_" + DateFormatUtils.format(new Date(), "yyyy-MM-dd_HH-mm-ss");
    }
    String name = JOptionPane.showInputDialog("名称", selectedName);
    if (StringUtils.isNotBlank(name)) {
        try {
            if (selectedImage != null) {
                File imageFile = FileUtil.touch(new File(IMAGE_PATH_PRE_FIX + name + ".png"));
                ImageIO.write(ImageUtil.toBufferedImage(selectedImage), "png", imageFile);
                ImageForm.initListTable();
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(App.mainFrame, "保存失败!\n\n" + ex.getMessage(), "失败", JOptionPane.ERROR_MESSAGE);
            log.error(ExceptionUtils.getStackTrace(ex));
        }
    }
}
 
Example 2
Source File: ConfigBaseUtil.java    From MooTool with MIT License 4 votes vote down vote up
ConfigBaseUtil() {
    setting = new Setting(FileUtil.touch(settingFilePath), CharsetUtil.CHARSET_UTF_8, false);
}
 
Example 3
Source File: ConfigBaseUtil.java    From WePush with MIT License 4 votes vote down vote up
ConfigBaseUtil() {
    setting = new Setting(FileUtil.touch(settingFilePath), CharsetUtil.CHARSET_UTF_8, false);
}