All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fm.last.commons.test.extensions.BaseDataFolder Maven / Gradle / Ivy

There is a newer version: 7.0.2
Show newest version
package fm.last.commons.test.extensions;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import fm.last.commons.test.core.DataFolderUtils;

public abstract class BaseDataFolder implements fm.last.commons.test.core.DataFolder {

  static final String FILE_SEPARATOR_REPLACEMENT = Matcher.quoteReplacement(File.separator);
  static final String PACKAGE_DELIMITER_PATTERN = Pattern.quote(".");

  /**
   * Implement to instantiate the data folder file
   * @return the data folder
   */
  public abstract File getDataFolder();

  @Override
  public File getFolder() throws IOException {
    return DataFolderUtils.getFolder(getDataFolder());
  }

  @Override
  public File getFile(String relativePath) throws IOException {
    return new File(getFolder(), relativePath);
  }

  @Override
  public String getAbsolutePath(String relativePath) throws IOException {
    return DataFolderUtils.getAbsolutePath(relativePath, getDataFolder());
  }

  @Override
  public URI getUri(String relativePath) throws IOException {
    return DataFolderUtils.getUri(relativePath, getDataFolder());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy