/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.apress;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;

/**
 *
 * @author pawelkor
 */
public class TranslationFileConverter {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String sourceFile = args[0];
        String destFile = args[1];
        String lineIn = "";
        try
        {
            DataInputStream in = new DataInputStream( new FileInputStream(sourceFile));
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            DataOutputStream out = new DataOutputStream(new FileOutputStream(destFile));

            while ( ( lineIn = br.readLine()) != null )
            {
                // Pomiń komentarze i puste wiersze
                if ( lineIn.length() == 0 || lineIn.charAt(0) == '#' )
                {
                    continue;
                }
                out.writeUTF(lineIn);
            }
            out.close();
            br.close();
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
            // Nic nie rób
        }
    }
}
