FileSystem fs = path.getFileSystem(getConf());
if (fs.exists(path)) {
System.err.println("given path exists already!");
return -1;
}
TypedBytesInput tbinput = new TypedBytesInput(new DataInputStream(System.in));
SequenceFile.Writer writer = SequenceFile.createWriter(fs, conf, path,
TypedBytesWritable.class, TypedBytesWritable.class);
try {
TypedBytesWritable key = new TypedBytesWritable();
TypedBytesWritable value = new TypedBytesWritable();
byte[] rawKey = tbinput.readRaw();
while (rawKey != null) {
byte[] rawValue = tbinput.readRaw();
key.set(rawKey, 0, rawKey.length);
value.set(rawValue, 0, rawValue.length);
writer.append(key, value);
rawKey = tbinput.readRaw();
}
} finally {
writer.close();
}
return 0;