|
|
|
@ -16,19 +16,13 @@ package com.github.sakserv.sequencefile;
|
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
|
|
import org.apache.hadoop.io.IntWritable;
|
|
|
|
|
import org.apache.hadoop.io.SequenceFile;
|
|
|
|
|
import org.apache.hadoop.io.Text;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
public class SequenceFileReader {
|
|
|
|
|
|
|
|
|
|
// Logger
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(SequenceFileReader.class);
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
|
|
String inputFile = args[0];
|
|
|
|
@ -42,15 +36,16 @@ public class SequenceFileReader {
|
|
|
|
|
SequenceFile.Reader.file(seqFilePath));
|
|
|
|
|
|
|
|
|
|
Text key = new Text();
|
|
|
|
|
IntWritable val = new IntWritable();
|
|
|
|
|
Text val = new Text();
|
|
|
|
|
|
|
|
|
|
while (reader.next(key, val)) {
|
|
|
|
|
LOG.info("Sequence File Data: Key: " + key + "\tValue: " + val);
|
|
|
|
|
//LOG.info(val);
|
|
|
|
|
System.out.println(val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reader.close();
|
|
|
|
|
} catch(IOException e) {
|
|
|
|
|
LOG.error("ERROR: Could not load hadoop configuration");
|
|
|
|
|
System.err.println("ERROR: Could not load hadoop configuration");
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|