17 package uk.ac.cam.eng.extraction.hadoop.util;
19 import java.io.IOException;
21 import org.apache.hadoop.conf.Configuration;
22 import org.apache.hadoop.fs.FileSystem;
23 import org.apache.hadoop.fs.Path;
24 import org.apache.hadoop.io.SequenceFile;
25 import org.apache.hadoop.io.Writable;
26 import org.apache.hadoop.util.ReflectionUtils;
34 public static void main(String[] args)
throws IOException {
35 if (args.length != 1) {
36 System.err.println(
"Args: <sequence file to print>");
39 Configuration conf =
new Configuration();
40 FileSystem fs = FileSystem.get(conf);
41 Path path =
new Path(args[0]);
42 SequenceFile.Reader reader =
new SequenceFile.Reader(fs, path, conf);
43 Writable key = (Writable) ReflectionUtils.newInstance(
44 reader.getKeyClass(), conf);
45 Writable value = (Writable) ReflectionUtils.newInstance(
46 reader.getValueClass(), conf);
47 while (reader.next(key, value)) {
48 System.out.println(key +
"\t" + value);