Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FileSystem.moveFromLocalFile()


    List<Path> srcs = (List<Path>) va[0];
    Path dstPath = (Path) va[1];

    try {
      FileSystem dstFs = dstPath.getFileSystem(configuration);
      dstFs.moveFromLocalFile(srcs.toArray(new Path[srcs.size()]), dstPath);
    } catch (IOException ex) {
      throw new HadoopException("Cannot move resources " + ex.getMessage(), ex);
    }
  }
View Full Code Here


    void upload(String localFilePath, String remoteFilePath) throws Exception {
        Path outFile = new Path(String.format("%s/%s", directory, remoteFilePath));
        FileSystem fs = outFile.getFileSystem(hadoopConf);

        fs.mkdirs(outFile.getParent());
        fs.moveFromLocalFile(new Path(localFilePath), outFile);
    }

    @Override
    void notify(String filePath, long fileSize) throws Exception {
        JSONObject jsonMessage = new JSONObject();
View Full Code Here

        LOG.info("newJobDir "+ localTemp.toString() + " exists, delete it");
        fs.delete(newJobDir, true);
      }
      if (!oldJobDir.equals(newJobDir) && fs.exists(oldJobDir)) {
        fs.copyToLocalFile(oldJobDir, localTemp);
        fs.moveFromLocalFile(localTemp, newJobDir);
      }
      LOG.info("Job files copied to " + newJobDir.toString());
      return newId;
    }
View Full Code Here

   * Add local files to the indicated FileSystem name. src is removed.
   */
  void moveFromLocal(Path[] srcs, String dstf) throws IOException {
    Path dstPath = new Path(dstf);
    FileSystem dstFs = dstPath.getFileSystem(getConf());
    dstFs.moveFromLocalFile(srcs, dstPath);
  }

  /**
   * Add a local file to the indicated FileSystem name. src is removed.
   */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.