Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class IntChar {
- private File input, output;
- private BufferedReader in;
- private BufferedWriter out;
- public static void main(String[] args) {
- if(args.length != 2){
- System.out.println("Muss 2 Argumente haben");
- return;
- }
- try {
- IntChar c = new IntChar(args[0], args[1]);
- c.start();
- } catch (IOException e){
- System.out.println(e);
- }
- }
- public IntChar(String inputName, String outputName) throws IOException {
- input = new File(inputName);
- if(input.exists() == false || input.canRead() == false || input.isFile() == false)
- throw new IOException("Input nicht lesbar");
- output = new File(outputName);
- if(output.exists() == true)
- throw new IOException("Output schon vorhanden");
- in = new BufferedReader(new FileReader(input));
- out = new BufferedWriter(new FileWriter(output));
- }
- public void start() throws IOException {
- try {
- int zeichen;
- char character;
- while((zeichen = in.read()) != -1){
- character = (char) zeichen; // 32 -> ' '
- out.write(zeichen + ": " + character + "\n"); // Wandelt wieder um in Char
- }
- } finally {
- in.close();
- out.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement