Package org.apache.flink.core.fs

Examples of org.apache.flink.core.fs.Path


  }


  private File pathToFile(Path path) {
    if (!path.isAbsolute()) {
      path = new Path(getWorkingDirectory(), path);
    }
    return new File(path.toUri().getPath());
  }
View Full Code Here


    if (names == null) {
      return null;
    }
    results = new FileStatus[names.length];
    for (int i = 0; i < names.length; i++) {
      results[i] = getFileStatus(new Path(f, names[i]));
    }

    return results;
  }
View Full Code Here

   * @throws IOException
   *         thrown if an error occurred while creating the directory/directories
   */
  public boolean mkdirs(final Path f) throws IOException {

    final Path parent = f.getParent();
    final File p2f = pathToFile(f);
    return (parent == null || mkdirs(parent)) && (p2f.mkdir() || p2f.isDirectory());
  }
View Full Code Here

    if (exists(f) && !overwrite) {
      throw new IOException("File already exists:" + f);
    }

    final Path parent = f.getParent();
    if (parent != null && !mkdirs(parent)) {
      throw new IOException("Mkdirs failed to create " + parent.toString());
    }

    final File file = pathToFile(f);
    return new LocalDataOutputStream(file);
  }
View Full Code Here

  }

  @Override
  public Path getPath() {

    return new Path(fileStatus.getPath().toString());
  }
View Full Code Here

  }


  @Override
  public Path getWorkingDirectory() {
    return new Path(this.fs.getWorkingDirectory().toUri());
  }
View Full Code Here

      PrintStream ps = new  PrintStream(tempFile);
      ps.println(FIRST);
      ps.println(SECOND);
      ps.close();
     
      TextInputFormat inputFormat = new TextInputFormat(new Path(tempFile.toURI().toString()));
     
      Configuration parameters = new Configuration();
      inputFormat.configure(parameters);
     
      FileInputSplit[] splits = inputFormat.createInputSplits(1);
View Full Code Here

     
      OutputStreamWriter wrt = new OutputStreamWriter(new FileOutputStream(tempFile));
      wrt.write(CONTENT);
      wrt.close();
     
      TextInputFormat inputFormat = new TextInputFormat(new Path(tempFile.toURI().toString()));
      inputFormat.setFilePath(tempFile.toURI().toString());
     
      Configuration parameters = new Configuration();
      inputFormat.configure(parameters);
     
View Full Code Here

   
    FileWriter wrt = new FileWriter(tempFile);
    wrt.write(content);
    wrt.close();
     
    return new FileInputSplit(0, new Path(tempFile.toURI().toString()), 0, tempFile.length(), new String[] {"localhost"});
  }
View Full Code Here

     
      OutputStreamWriter wrt = new OutputStreamWriter(new FileOutputStream(tempFile));
      wrt.write(fileContent);
      wrt.close();
     
      CsvInputFormat<Tuple1<String>> inputFormat = new CsvInputFormat<Tuple1<String>>(new Path(tempFile.toURI().toString()),String.class);
     
      Configuration parameters = new Configuration();
      inputFormat.configure(parameters);
     
      inputFormat.setDelimiter(lineBreakerSetup);
View Full Code Here

TOP

Related Classes of org.apache.flink.core.fs.Path

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.