Demo entry 6660424

hdfs

   

Submitted by anonymous on Nov 15, 2017 at 12:05
Language: Java. Code size: 510 Bytes.

package hdfs;

import java.io.InputStream;
import java.net.URL;

import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.io.IOUtils;

public class java1 {
	static final String PATH = "hdfs://hadoop:9000/URL";
	public static void main(String[] args) throws Exception {
		URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
		
		final URL url = new URL(PATH);
		final InputStream in = url.openStream();

		IOUtils.copyBytes(in, System.out, 1024, true);
	}
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).