/** * Called when we're all done writing to the target. * A local FS will do nothing, because we've written to exactly the * right place. * A remote FS will copy the contents of tmpLocalFile to the correct target at * fsOutputFile. * @param fsOutputFile path of output file * @param tmpLocalFile path to local tmp file * @throws IOException IO failure */ public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { moveFromLocalFile(tmpLocalFile, fsOutputFile); }
public static void moveToCloud(String srcLocalPath, String dstCloudPath) throws IOException { Path srcPath = new Path(srcLocalPath); Path dstPath = new Path(dstCloudPath); getFileSystem(dstCloudPath).moveFromLocalFile(srcPath, dstPath); }
public void moveFromLocalFile(Path[] srcs, Path dst) throws java.io.IOException { this.underlyingFs.moveFromLocalFile(replaceScheme(srcs, this.replacementScheme, this.underlyingScheme), replaceScheme(dst, this.replacementScheme, this.underlyingScheme)); }
public void moveFromLocalFile(Path src, Path dst) throws java.io.IOException { this.underlyingFs.moveFromLocalFile(replaceScheme(src, this.replacementScheme, this.underlyingScheme), replaceScheme(dst, this.replacementScheme, this.underlyingScheme)); }
/** * Called when we're all done writing to the target. A local FS will * do nothing, because we've written to exactly the right place. A remote * FS will copy the contents of tmpLocalFile to the correct target at * fsOutputFile. * @param fsOutputFile path of output file * @param tmpLocalFile path to local tmp file */ public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { moveFromLocalFile(tmpLocalFile, fsOutputFile); }
/** * Called when we're all done writing to the target. A local FS will * do nothing, because we've written to exactly the right place. A remote * FS will copy the contents of tmpLocalFile to the correct target at * fsOutputFile. */ public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { moveFromLocalFile(tmpLocalFile, fsOutputFile); }
@Override public void moveFromLocalFile(Path[] srcs, Path dst) throws IOException { underlyingFs.moveFromLocalFile(srcs, dst); }
/** * Called when we're all done writing to the target. A local FS will * do nothing, because we've written to exactly the right place. A remote * FS will copy the contents of tmpLocalFile to the correct target at * fsOutputFile. * @param fsOutputFile path of output file * @param tmpLocalFile path to local tmp file */ public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { moveFromLocalFile(tmpLocalFile, fsOutputFile); }
/** * Called when we're all done writing to the target. A local FS will * do nothing, because we've written to exactly the right place. A remote * FS will copy the contents of tmpLocalFile to the correct target at * fsOutputFile. */ public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { moveFromLocalFile(tmpLocalFile, fsOutputFile); }
/** * Called when we're all done writing to the target. A local FS will * do nothing, because we've written to exactly the right place. A remote * FS will copy the contents of tmpLocalFile to the correct target at * fsOutputFile. * @param fsOutputFile path of output file * @param tmpLocalFile path to local tmp file */ public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { moveFromLocalFile(tmpLocalFile, fsOutputFile); }
public static void writeText(FileSystem fs, Path outPath, String content) throws IOException { long timestamp = System.currentTimeMillis(); String localFile = "/tmp/Kafka_tmp_" + timestamp; PrintWriter writer = new PrintWriter(new FileWriter(localFile)); writer.println(content); writer.close(); Path src = new Path(localFile); fs.moveFromLocalFile(src, outPath); }
@Override 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 public void moveFromLocalFile(Path[] srcs, Path dst) throws IOException { try { underlyingFs.moveFromLocalFile(srcs, dst); } catch(FSError e) { throw propagateFSError(e); } }
@Override public void moveFromLocalFile(Path src, Path dst) throws IOException { try { underlyingFs.moveFromLocalFile(src, dst); } catch(FSError e) { throw propagateFSError(e); } }
public static void moveFromLocalFile(String file, ImmutableConfig conf) throws IOException { if (Files.exists(Paths.get(file))) { FileSystem fs = FileSystem.get(conf.unbox()); org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(file); fs.moveFromLocalFile(path, path); } }
/** * 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 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); }
@Override public void moveFromLocalFile(Path src, Path dst) throws IOException { fileSystem.moveFromLocalFile(convertToDefaultPath(src), convertToDefaultPath(dst)); }
public void moveFromLocalFile(Path[] srcs, Path dst) throws java.io.IOException { this.underlyingFs.moveFromLocalFile(replaceScheme(srcs, this.replacementScheme, this.underlyingScheme), replaceScheme(dst, this.replacementScheme, this.underlyingScheme)); }
@Override public void moveFromLocalFile(Path src, Path dst) throws IOException { fileSystem.moveFromLocalFile(convertToDefaultPath(src), convertToDefaultPath(dst)); }