Package org.apache.flink.core.fs

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



  @Override
  public FSDataInputStream open(final Path f) throws IOException {

    final FileStatus fileStatus = getFileStatus(f); // Will throw FileNotFoundException if f does not exist

    // Make sure f is not a directory
    if (fileStatus.isDir()) {
      throw new IOException("Cannot open " + f.toUri() + " because it is a directory");
    }

    final S3BucketObjectPair bop = this.directoryStructure.toBucketObjectPair(f);
    if (!bop.hasBucket() || !bop.hasObject()) {
View Full Code Here


  @Override
  public boolean delete(Path f, boolean recursive) throws IOException {

    try {
      final FileStatus fileStatus = getFileStatus(f); // Will throw a FileNotFoundException if f is invalid
      final S3BucketObjectPair bop = this.directoryStructure.toBucketObjectPair(f);

      if (fileStatus.isDir()) {

        boolean retVal = false;
        final FileStatus[] dirContent = listStatus(f);
        if (dirContent.length > 0) {
          // Directory is not empty
View Full Code Here

    if (inputSplits.size() < minNumSplits) {
      LOG.warn(String.format(
        "With the given block size %d, the file %s cannot be split into %d blocks. Filling up with empty splits...",
        blockSize, this.filePath, minNumSplits));
      FileStatus last = files.get(files.size() - 1);
      final BlockLocation[] blocks = fs.getFileBlockLocations(last, 0, last.getLen());
      for (int index = files.size(); index < minNumSplits; index++) {
        inputSplits.add(new FileInputSplit(index, last.getPath(), last.getLen(), 0, blocks[0].getHosts()));
      }
    }

    return inputSplits.toArray(new FileInputSplit[0]);
  }
View Full Code Here

  protected List<FileStatus> getFiles() throws IOException {
    // get all the files that are involved in the splits
    List<FileStatus> files = new ArrayList<FileStatus>();

    final FileSystem fs = this.filePath.getFileSystem();
    final FileStatus pathFile = fs.getFileStatus(this.filePath);

    if (pathFile.isDir()) {
      // input is directory. list all contained files
      final FileStatus[] partials = fs.listStatus(this.filePath);
      for (int i = 0; i < partials.length; i++) {
        if (!partials[i].isDir()) {
          files.add(partials[i]);
View Full Code Here

TOP

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

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.