Created
October 4, 2016 12:42
-
-
Save muthugit/d2d0485473e8ba56f1fcf443e6454b46 to your computer and use it in GitHub Desktop.
Read and print file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hadoop; | |
import java.io.*; | |
import java.util.*; | |
import java.net.*; | |
import org.apache.hadoop.fs.*; | |
import org.apache.hadoop.conf.*; | |
import org.apache.hadoop.io.*; | |
import org.apache.hadoop.mapred.*; | |
import org.apache.hadoop.util.*; | |
public class Cat { | |
public static void main(String[] args) throws Exception { | |
try { | |
Path pt = new Path("hdfs://localhost:9000/hadoop/transaction.csv"); | |
FileSystem fs = FileSystem.get(new Configuration()); | |
BufferedReader br = new BufferedReader(new InputStreamReader(fs.open(pt))); | |
String line; | |
line = br.readLine(); | |
while (line != null) { | |
System.out.println(line); | |
line = br.readLine(); | |
} | |
} catch (Exception e) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment