Converter.java Source code

Java tutorial

Introduction

Here is the source code for Converter.java

Source

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Converter {
    public static void main(String args[]) throws Exception {
        FileInputStream fis = new FileInputStream(new File("input.txt"));
        BufferedReader in = new BufferedReader(new InputStreamReader(fis, "SJIS"));

        FileOutputStream fos = new FileOutputStream(new File("output.txt"));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos, "UTF8"));

        int len = 80;
        char buf[] = new char[len];

        int numRead;
        while ((numRead = in.read(buf, 0, len)) != -1)
            out.write(buf, 0, numRead);
        out.close();
        in.close();
    }
}