private void parse(CommandLine line) throws FileNotFoundException, UnsupportedEncodingException {
        if(line.getArgList().isEmpty() || line.hasOption("help")) {
            printUsage();
            return;
        }

        if(line.hasOption("in")) {
            String inFile = line.getOptionValue("in");
            File file = new File(inFile);
            if(!file.exists()) {
                System.err.println("File not found at " + file);
                return;
            }
            inputStream = new FileInputStream(file);
        }
        else {
            System.out.println("Waiting for data in standard input");
            inputStream = System.in;
        }

        if(line.hasOption("out")) {
            String outFile = line.getOptionValue("out");
            File file = new File(outFile);
            if(file.exists()) {
                System.out.println("File " + file + " will be overwritten");
            }
            File parentFile = file.getParentFile();
            if(!parentFile.mkdirs() && !parentFile.exists()) {
                System.err.println("Failed to create parent directory at " + parentFile);
                return;
            }

            out = new PrintStream(new FileOutputStream(file, false), true, "utf-8");
        }
        else {
            out = System.out;
        }

        fontName = line.getOptionValue("font", "jd");
        dotExec = line.getOptionValue("dot", "/usr/local/bin/dot");
        direction = line.getOptionValue("direction", "TD");
    }