/** * Resolve a child path against a parent path. * * @param parent * the parent path * @param child * the child path */ public Path(Path parent, String child) { this(parent, new Path(child)); }
/** * Resolve a child path against a parent path. * * @param parent * the parent path * @param child * the child path */ public Path(String parent, Path child) { this(new Path(parent), child); }
/** * Resolve a child path against a parent path. * * @param parent * the parent path * @param child * the child path */ public Path(Path parent, String child) { this(parent, new Path(child)); }
/** * Resolve a child path against a parent path. * * @param parent * the parent path * @param child * the child path */ public Path(String parent, Path child) { this(new Path(parent), child); }
/** * Creates a <code>LocalFileStatus</code> object from a given {@link File} object. * * @param f * the {@link File} object this <code>LocalFileStatus</code> refers to * @param fs * the file system the corresponding file has been read from */ public LocalFileStatus(final File f, final FileSystem fs) { this.file = f; this.path = new Path(fs.getUri().getScheme() + ":" + f.toURI().getPath()); }
/** * Creates a <code>LocalFileStatus</code> object from a given {@link File} object. * * @param f * the {@link File} object this <code>LocalFileStatus</code> refers to * @param fs * the file system the corresponding file has been read from */ public LocalFileStatus(final File f, final FileSystem fs) { this.file = f; this.path = new Path(fs.getUri().getScheme() + ":" + f.toURI().getPath()); }
/** * Writes a DataSet as a text file to the specified location.<br/> * For each element of the DataSet the result of {@link Object#toString()} is written. * * @param filePath The path pointing to the location the text file is written to. * @return The DataSink that writes the DataSet. * * @see TextOutputFormat */ public DataSink<T> writeAsText(String filePath) { return output(new TextOutputFormat<T>(new Path(filePath))); }
/** * Creates a DataSet that represents the Strings produced by reading the given file line wise. * The file will be read with the system's default character set. * * @param filePath The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path"). * @return A DataSet that represents the data read from the given file as text lines. */ public DataSource<String> readTextFile(String filePath) { Validate.notNull(filePath, "The file path may not be null."); return new DataSource<String>(this, new TextInputFormat(new Path(filePath)), BasicTypeInfo.STRING_TYPE_INFO ); }
@Override public void read(final DataInput in) throws IOException { super.read(in); // Read path of the input file boolean isNotNull = in.readBoolean(); if (isNotNull) { this.path = new Path(); this.path.read(in); } }
@Override public void read(final DataInput in) throws IOException { super.read(in); // Read path of the input file final boolean isNotNull = in.readBoolean(); if (isNotNull) { this.path = new Path(); this.path.read(in); } }
@Override public void read(final DataInput in) throws IOException { super.read(in); // Read path of the input file final boolean isNotNull = in.readBoolean(); if (isNotNull) { this.path = new Path(); this.path.read(in); } }
@Override public void read(final DataInput in) throws IOException { super.read(in); // Read path of the input file boolean isNotNull = in.readBoolean(); if (isNotNull) { this.path = new Path(); this.path.read(in); } }
/** * Adds a suffix to the final name in the path. * * @param suffix The suffix to be added * @return the new path including the suffix */ public Path suffix(String suffix) { return new Path(getParent(), getName() + suffix); }
private File pathToFile(Path path) { if (!path.isAbsolute()) { path = new Path(getWorkingDirectory(), path); } return new File(path.toUri().getPath()); }
private JobGraph getJobGraph(OptimizedPlan optPlan, List<File> jarFiles) { NepheleJobGraphGenerator gen = new NepheleJobGraphGenerator(); JobGraph job = gen.compileJobGraph(optPlan); for (File jar : jarFiles) { job.addJar(new Path(jar.getAbsolutePath())); } return job; }
private JobGraph getJobGraph(OptimizedPlan optPlan, List<File> jarFiles) { NepheleJobGraphGenerator gen = new NepheleJobGraphGenerator(); JobGraph job = gen.compileJobGraph(optPlan); for (File jar : jarFiles) { job.addJar(new Path(jar.getAbsolutePath())); } return job; }
private FileInputSplit createTempFile(String contents) throws IOException { this.tempFile = File.createTempFile("test_contents", "tmp"); this.tempFile.deleteOnExit(); OutputStreamWriter wrt = new OutputStreamWriter(new FileOutputStream(this.tempFile)); wrt.write(contents); wrt.close(); return new FileInputSplit(0, new Path(this.tempFile.toURI().toString()), 0, this.tempFile.length(), new String[] {"localhost"}); }
private FileInputSplit createTempFile(String content) throws IOException { this.tempFile = File.createTempFile("test_contents", "tmp"); this.tempFile.deleteOnExit(); DataOutputStream dos = new DataOutputStream(new FileOutputStream(tempFile)); dos.writeBytes(content); dos.close(); return new FileInputSplit(0, new Path(this.tempFile.toURI().toString()), 0, this.tempFile.length(), new String[] {"localhost"}); }
@Before public void setup() { this.format.setFilePath(new Path("file:///some/file/that/will/not/be/read")); this.config = new Configuration(); }
private static JobOutputVertex createOutput(JobGraph jobGraph, String resultPath, int numSubTasks, TypeSerializerFactory<?> serializer) { JobOutputVertex output = JobGraphUtils.createFileOutput(jobGraph, "Output", numSubTasks, numSubTasks); { TaskConfig taskConfig = new TaskConfig(output.getConfiguration()); taskConfig.addInputToGroup(0); taskConfig.setInputSerializer(serializer, 0); PointOutFormat outFormat = new PointOutFormat(); outFormat.setOutputFilePath(new Path(resultPath)); taskConfig.setStubWrapper(new UserCodeObjectWrapper<PointOutFormat>(outFormat)); } return output; }