public static void main(String[] args) throws Exception {
    String usage = "Usage: MapFile inFile outFile";
      
    if (args.length != 2) {
      System.err.println(usage);
      System.exit(-1);
    }
      
    String in = args[0];
    String out = args[1];

    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.getLocal(conf);
    MapFile.Reader reader = null;
    try {
      reader = new MapFile.Reader(fs, in, conf);
      WritableComparable<?> key = ReflectionUtils.newInstance(
          reader.getKeyClass().asSubclass(WritableComparable.class), conf);
      Writable value = ReflectionUtils.newInstance(reader.getValueClass()
        .asSubclass(Writable.class), conf);

      try (MapFile.Writer writer = new MapFile.Writer(conf, fs, out,
            reader.getKeyClass().asSubclass(WritableComparable.class),
            reader.getValueClass())) {
        while (reader.next(key, value)) {             // copy all entries
          writer.append(key, value);
        }
      }
    } finally {
      IOUtils.cleanupWithLogger(LOG, reader);
    }
  }
@Test
  public void testMainMethodMapFile() {
    String inFile = "mainMethodMapFile.mapfile";
    String path = new Path(TEST_DIR, inFile).toString();
    String[] args = { path, path };
    MapFile.Writer writer = null;
    try {
      writer = createWriter(inFile, IntWritable.class, Text.class);
      writer.append(new IntWritable(1), new Text("test_text1"));
      writer.append(new IntWritable(2), new Text("test_text2"));
      writer.close();
      MapFile.main(args);
    } catch (Exception ex) {
      fail("testMainMethodMapFile error !!!");
    } finally {
      IOUtils.cleanupWithLogger(null, writer);
    }
  }