Codota Logo
LocalFileSystem
Code IndexAdd Codota to your IDE (free)

How to use
LocalFileSystem
in
org.qcri.rheem.core.util.fs

Best Java code snippets using org.qcri.rheem.core.util.fs.LocalFileSystem (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: org.qcri.rheem/rheem-core

@Override
public OutputStream create(String url) throws IOException {
  return this.create(url, false);
}
origin: org.qcri.rheem/rheem-core

@Override
public boolean delete(String url, boolean isRecursiveDelete) throws IOException {
  try {
    final File file = toFile(url);
    if (!isRecursiveDelete && file.isDirectory()) return false;
    return this.delete(file);
  } catch (URISyntaxException e) {
    throw new IOException("Cannot access file.", e);
  }
}
origin: org.qcri.rheem/rheem-basic

@Override
public void setProperties(Configuration configuration) {
  configuration.load(ReflectionUtils.loadResource(RHEEM_BASIC_DEFAULTS_PROPERTIES));
  final File localTempDir = LocalFileSystem.findTempDir();
  if (localTempDir != null) {
    configuration.setProperty(TEMP_DIR_PROPERTY, LocalFileSystem.toURL(localTempDir));
  }
}
origin: org.qcri.rheem/rheem-graphchi

@Override
public void setProperties(Configuration configuration) {
  final File localTempDir = LocalFileSystem.findTempDir();
  if (localTempDir != null) {
    configuration.setProperty("rheem.graphchi.tempdir", localTempDir.toString());
  }
}
origin: org.qcri.rheem/rheem-core

@Override
public boolean isDirectory(String url) {
  try {
    return toFile(url).isDirectory();
  } catch (URISyntaxException | MalformedURLException e) {
    logger.warn("Could not inspect directory.", e);
    return false;
  }
}
origin: org.qcri.rheem/rheem-core

/**
 * Create an empty file.
 *
 * @param file that should be created
 */
public static void touch(File file) {
  ensureDir(file.getParentFile());
  try (FileOutputStream fos = new FileOutputStream(file)) {
  } catch (IOException e) {
    throw new RheemException(String.format("Could not create %s.", file), e);
  }
}
origin: org.qcri.rheem/rheem-graphchi

);
final File tempFile = new File(tempFilePath);
LocalFileSystem.touch(tempFile);
tempFile.deleteOnExit();
String graphName = tempFile.toString();
origin: org.qcri.rheem/rheem-core

@Override
public InputStream open(String url) throws IOException {
  try {
    File file = toFile(url);
    return new FileInputStream(file);
  } catch (URISyntaxException e) {
    throw new IOException("Could not process the given URL.", e);
  }
}
origin: org.qcri.rheem/rheem-core

@Override
public long getFileSize(String fileUrl) throws FileNotFoundException {
  try {
    File file = toFile(fileUrl);
    return file.length();
  } catch (MalformedURLException | URISyntaxException e) {
    logger.error("Illegal URL: \"{}\"", fileUrl);
    throw new FileNotFoundException("File not found, because the URL is not correct.");
  }
}
origin: org.qcri.rheem/rheem-core

private static File toFile(String fileUrl) throws URISyntaxException, MalformedURLException {
  if (fileUrl.startsWith("file:")) {
    return new File(new URL(fileUrl).toURI());
  } else {
    logger.warn("Expect URLs, but got {}. Converting it to file:{}...", fileUrl, fileUrl);
    return toFile("file:" + fileUrl);
  }
}
origin: org.qcri.rheem/rheem-core

@Override
public Collection<String> listChildren(String url) {
  try {
    final File[] files = toFile(url).listFiles();
    if (files == null) {
      return Collections.emptyList();
    }
    return Arrays.stream(files).map(File::toURI).map(Object::toString).collect(Collectors.toList());
  } catch (URISyntaxException | MalformedURLException e) {
    logger.warn("Could not inspect directory.", e);
    return Collections.emptyList();
  }
}
origin: org.qcri.rheem/rheem-core

@Override
public OutputStream create(String url, Boolean forceCreateParentDirs) throws IOException {
  File file = null;
  try {
    file = toFile(url);
    if (forceCreateParentDirs && file.getParentFile()!=null)
      file.getParentFile().mkdirs();
    return new FileOutputStream(file, false);
  } catch (URISyntaxException e) {
    throw new IOException("Could not process the given URL.", e);
  } catch (IOException e) {
    if (file != null) {
      file.delete();
    }
    throw e;
  }
}
org.qcri.rheem.core.util.fsLocalFileSystem

Javadoc

FileSystem implementation for the local file system.

Most used methods

  • findTempDir
    Retrieves a directory that can be used for temporary files.
  • create
  • delete
  • ensureDir
    Ensure that there is a directory represented by the given File.
  • toFile
  • toURL
    Converts a File object to a URL.
  • touch
    Create an empty file.

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • putExtra (Intent)
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Collectors (java.util.stream)
  • JCheckBox (javax.swing)
  • JComboBox (javax.swing)
  • JList (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now