@Test void createNewFile() throws Exception { final YamlFile yamlFile = new YamlFile(tempFile()); yamlFile.deleteFile(); MatcherAssert.assertThat( "The file already exists!", yamlFile.exists(), new IsNot<>(new IsTrue()) ); yamlFile.createNewFile(false); MatcherAssert.assertThat( "The file couldn't be found!", yamlFile.exists(), new IsTrue() ); }
public void createNewFile(final boolean overwrite) throws IOException { Validate.notNull(this.configFile, "This configuration file is null!"); if (overwrite || !this.configFile.exists()) { try { final File parents = this.configFile.getParentFile(); if (parents != null) { parents.mkdirs(); } this.configFile.createNewFile(); } catch (final SecurityException e) { throw new IOException(e.getMessage(), e.getCause()); } } }
YamlFile extends YamlConfiguration implements Commentable { public void createNewFile(final boolean overwrite) throws IOException { Validate.notNull(this.configFile, "This configuration file is null!"); if (overwrite || !this.configFile.exists()) { try { final File parents = this.configFile.getParentFile(); if (parents != null) { parents.mkdirs(); } this.configFile.createNewFile(); } catch (final SecurityException e) { throw new IOException(e.getMessage(), e.getCause()); } } } }
YamlFile extends YamlConfiguration implements Commentable { public void createNewFile(final boolean overwrite) throws IOException { Validate.notNull(this.configFile, "This configuration file is null!"); if (overwrite || !this.configFile.exists()) { try { final File parents = this.configFile.getParentFile(); if (parents != null) { parents.mkdirs(); } this.configFile.createNewFile(); } catch (final SecurityException e) { throw new IOException(e.getMessage(), e.getCause()); } } } YamlFile();  YamlFile(final String path);  YamlFile(final File file);  YamlFile(final URI uri);  YamlFile(final URL url); }
YamlFile extends YamlConfiguration implements Commentable { public void createNewFile(final boolean overwrite) throws IOException { Validate.notNull(this.configFile, "This configuration file is null!"); if (overwrite || !this.configFile.exists()) { try { final File parents = this.configFile.getParentFile(); if (parents != null) { parents.mkdirs(); } this.configFile.createNewFile(); } catch (final SecurityException e) { throw new IOException(e.getMessage(), e.getCause()); } } } YamlFile();  YamlFile(final String path);  YamlFile(final File file);  YamlFile(final URI uri);  YamlFile(final URL url); void save(); String saveToString(); @Override void setComment(final String path, final String comment, final CommentType type); @Override String getComment(final String path, final CommentType type); void load(); void loadWithComments(); @Override void loadFromString(final String contents); void createOrLoad(); void createOrLoadWithComments(); boolean exists(); void createNewFile(final boolean overwrite); void deleteFile(); long getSize(); String getFilePath(); File getConfigurationFile(); void setConfigurationFile(final String path); void setConfigurationFile(final URI uri); void setConfigurationFile(final File file); File copyTo(final String path); void copyTo(final File file); String fileToString(); @Override String toString(); static YamlFile loadConfiguration(final File file, boolean withComments); static YamlFile loadConfiguration(final File file); static YamlFile loadConfiguration(final InputStream stream, boolean withComments); static YamlFile loadConfiguration(final InputStream stream); static YamlFile loadConfiguration(final Reader reader, boolean withComments); static YamlFile loadConfiguration(final Reader reader); }
YamlFile extends YamlConfiguration implements Commentable { public void createNewFile(final boolean overwrite) throws IOException { Validate.notNull(this.configFile, "This configuration file is null!"); if (overwrite || !this.configFile.exists()) { try { final File parents = this.configFile.getParentFile(); if (parents != null) { parents.mkdirs(); } this.configFile.createNewFile(); } catch (final SecurityException e) { throw new IOException(e.getMessage(), e.getCause()); } } } YamlFile();  YamlFile(final String path);  YamlFile(final File file);  YamlFile(final URI uri);  YamlFile(final URL url); void save(); String saveToString(); @Override void setComment(final String path, final String comment, final CommentType type); @Override String getComment(final String path, final CommentType type); void load(); void loadWithComments(); @Override void loadFromString(final String contents); void createOrLoad(); void createOrLoadWithComments(); boolean exists(); void createNewFile(final boolean overwrite); void deleteFile(); long getSize(); String getFilePath(); File getConfigurationFile(); void setConfigurationFile(final String path); void setConfigurationFile(final URI uri); void setConfigurationFile(final File file); File copyTo(final String path); void copyTo(final File file); String fileToString(); @Override String toString(); static YamlFile loadConfiguration(final File file, boolean withComments); static YamlFile loadConfiguration(final File file); static YamlFile loadConfiguration(final InputStream stream, boolean withComments); static YamlFile loadConfiguration(final InputStream stream); static YamlFile loadConfiguration(final Reader reader, boolean withComments); static YamlFile loadConfiguration(final Reader reader);  }