FileSystem fs = FileSystem.get(conf);
Path path = new Path("appledata/apples");
SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf,
path, Text.class, VectorWritable.class);
VectorWritable vec = new VectorWritable();
for (NamedVector vector : apples) {
vec.set(vector);
writer.append(new Text(vector.getName()), vec);
}
writer.close();
SequenceFile.Reader reader = new SequenceFile.Reader(fs,
new Path("appledata/apples"), conf);
Text key = new Text();
VectorWritable value = new VectorWritable();
while (reader.next(key, value)) {
System.out.println(key.toString() + " " + value.get().asFormatString());
}
reader.close();
}