/*
* Created on 2005/02/09
* Author aki@www.xucker.jpn.org
* License Apache2.0 or Common Public License
*/
package org.jpn.xucker.commons.ipod;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
/**
*
*
*/
public class TextConvertTest {
public static void main(String[] args) {
try {
File file=new File(args[0]);
int index=file.getName().lastIndexOf(".");
String baseName=file.getName();
if(index!=-1){
baseName=baseName.substring(0,index);
}
String text=IOUtils.toString(new FileReader(file));
TextConverter converter=new TextConverter();
TextConverter.log.trace("convert");
String result[]=converter.convert(baseName,text);
for(int i=0;i<result.length;i++){
FileUtils.writeStringToFile(new File("c:\\tmp\\"+baseName+(i+1)+".txt"),result[i],"Shift_JIS");
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|