public static void main(String[] args) throws IOException {
        Options options = getOptions();
        CommandLine line = getCommandLine(options, args);
        InputStream in = System.in;
        PrintOutputStreamWrapper out = new PrintOutputStreamWrapper(System.out);

        if (line.hasOption("help")) {
            printHelp(options);
        } else if (line.hasOption("encode")) {
            LZW.encode(in, out);
        } else if (line.hasOption("decode")) {
            LZW.decode(in, out);
        } else if (line.hasOption("encode-chunks")) {
            String valueString = line.getOptionValue("encode-chunks");
            int valueInt = valueString == null ? DEFAULT_MAX_DICTIONARY_SIZE : Integer.parseInt(valueString);
            LZW.encodeInChunks(in, out, valueInt);
        } else if (line.hasOption("decode-chunks")) {
            LZW.decodeChunks(in, out);
        } else {
            printHelp(options);
        }

        out.flush();
    }