OK, the problem was solved now.
org.apache.hadoop.io.SequenceFile.Writer works for me.
Configuration conf = new Configuration();
LocalFileSystem fs = FileSystem.getLocal(conf);
SequenceFile.Writer writer = SequenceFile.createWriter(fs, conf, new Path("~/test"), LongWritable.class, BytesWritable.class);
LongWritable key = new LongWritable(1L);
BytesWritable val = new BytesWritable(protobufObject.toByteArray());
writer.append(key, val);
writer.close();