All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dua3.meja.converter.Converter Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
/*
 *
 */
package com.dua3.meja.converter;

import java.io.File;
import java.io.IOException;

import com.dua3.meja.model.Workbook;
import com.dua3.meja.model.generic.GenericWorkbookFactory;

/**
 * Converter sample application.
 * 

* Demonstrates reading and writing workbooks. The relevant format of the input * and output filenames is determined by the file extension. *

* * @author Axel Howind ([email protected]) */ public final class Converter { private Converter() { } /** * The main method is the entry point of the program. * * @param args an array of strings representing the command line arguments. * The first argument should be the path of the input file, * and the second argument should be the path of the output file. */ @SuppressWarnings("UseOfSystemOutOrSystemErr") public static void main(String[] args) { if (args.length != 2) { System.out.format("Usage: %s %n", Converter.class.getName()); System.exit(1); } File in = new File(args[0]); File out = new File(args[1]); if (out.exists()) { System.err.println("Outfile already exists."); } try (Workbook workbook = GenericWorkbookFactory.instance().open(in.toURI())) { workbook.write(out.toURI()); System.out.println("Data written to " + out.getAbsolutePath()); } catch (IOException ex) { System.err.println("IO error: " + ex.getMessage()); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy