<commit_before>package examples.pokerhands.client;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

import examples.pokerhands.model.Hand;
import examples.pokerhands.valuation.Rater;
import examples.pokerhands.valuation.Valuation;

public class SimpleComparer {

	private Rater rater;

	public SimpleComparer() {
		super();
		rater = new Rater();
		rater.registerAll();
	}

	public boolean compare2Hands(InputStream in, OutputStream out) {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
		Parser parser = new Parser();
		
		try {
			out.write("Enter hand 1: ".getBytes());
			out.flush();
			String line1 = reader.readLine();
			Hand hand1 = parser.parseHand(line1);
			Valuation v1 = rater.rate(hand1);
			
			out.write("Enter hand 2: ".getBytes());
			out.flush();
			String line2 = reader.readLine();
			Hand hand2 = parser.parseHand(line2);
			Valuation v2 = rater.rate(hand2);
			
			int result = v1.compareTo(v2);
			
			if(result > 0) {
				out.write("Winning hand: ".getBytes());
				out.write(hand1.toString().getBytes());
				out.write((" (" + v1.getRank().toString() + ")").getBytes());
			} else if(result < 0) {
				out.write("Winning hand: ".getBytes());
				out.write(hand2.toString().getBytes());		
				out.write((" (" + v2.getRank().toString() + ")").getBytes());
			} else {
				out.write("No winning hand".getBytes());
			}
			out.write("\n\n".getBytes());
			
			writer.flush();
		} catch (Exception e) {
			try {
				writer.write("Exception:" + e);
			} catch (IOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			return false;
		}<commit_msg>Use Buffered output in comparer<commit_after>package examples.pokerhands.client;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

import examples.pokerhands.model.Hand;
import examples.pokerhands.valuation.Rater;
import examples.pokerhands.valuation.Valuation;

public class SimpleComparer {

	private Rater rater;

	public SimpleComparer() {
		super();
		rater = new Rater();
		rater.registerAll();
	}

	public boolean compare2Hands(InputStream in, OutputStream out) {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
		Parser parser = new Parser();
		
		try {
			writer.write("Enter hand 1: ");
			writer.flush();
			String line1 = reader.readLine();
			if(null == line1) {
				line1 = "";
			}
			Hand hand1 = parser.parseHand(line1);
			Valuation v1 = rater.rate(hand1);
			
			writer.write("Enter hand 2: ");
			writer.flush();
			String line2 = reader.readLine();
			if(null == line2) {
				line2 = "";
			}
			Hand hand2 = parser.parseHand(line2);
			Valuation v2 = rater.rate(hand2);
			
			int result = v1.compareTo(v2);
			
			if(result > 0) {
				writer.write("Winning hand: ");
				writer.write(hand1.toString());
				writer.write(" (" + v1.getRank().toString() + ")");
			} else if(result < 0) {
				writer.write("Winning hand: ");
				writer.write(hand2.toString());
				writer.write(" (" + v2.getRank().toString() + ")");
			} else {
				writer.write("No winning hand");
			}
			writer.write("\n\n");
			writer.flush();
		} catch (Exception e) {
			try {
				writer.write("Exception:" + e);
				writer.flush();
			} catch (IOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			return false;
		}
{'fraction_non_alphanumeric': 0.14978902953586498, 'fraction_numerical': 0.013185654008438819, 'mean_word_length': 3.6769420468557334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7552340', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1213, 'n_words': 261}