<commit_before>package steamcondenser.steam;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;

import steamcondenser.steam.packets.SteamPacket;

/**
 * @author <NAME>
 * @version $Id$
 */
public class SteamSocket
{
	private ByteBuffer buffer;
	
	private DatagramChannel channel;
	
	private Selector selector;
	
	/**
	 * @param ipAddress The IP of the server to connect to
	 * @param portNumber The port number of the server
	 */
	public SteamSocket(InetAddress ipAddress, int portNumber)
		throws IOException
	{
		this.buffer = ByteBuffer.allocate(1400);
		this.buffer.order(ByteOrder.LITTLE_ENDIAN);
		
		this.channel = DatagramChannel.open();
		this.channel.connect(new InetSocketAddress(ipAddress, portNumber));
		this.channel.configureBlocking(false);
	}
	
	public SteamPacket getReply()
		throws IOException, Exception
	{
		Selector selector = Selector.open();
		this.channel.register(selector, SelectionKey.OP_READ);
		if(this.selector.select(1000) == 0)
		{
			throw new TimeoutException();
		}
		
		int bytesRead;
		byte[] packetData = new byte[0];
		
		SteamPacket packet;

		this.buffer = ByteBuffer.allocate(1400);
		bytesRead = this.channel.read(this.buffer);
		this.buffer.rewind();
		this.buffer.limit(bytesRead);
		
		if(this.buffer.getInt() == -2L)
		{
			byte[] splitData, tmpData;
			int packetCount, packetNumber;
			long requestId;
			short splitSize;
			
			do
			{
				requestId = this.buffer.getInt();
				packetCount = this.buffer.get();<commit_msg>(Java) Removed obsolete SteamSocket.selector<commit_after>package steamcondenser.steam;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;

import steamcondenser.steam.packets.SteamPacket;

/**
 * @author <NAME>
 * @version $Id$
 */
public class SteamSocket
{
	private ByteBuffer buffer;
	
	private DatagramChannel channel;
	
	/**
	 * @param ipAddress The IP of the server to connect to
	 * @param portNumber The port number of the server
	 */
	public SteamSocket(InetAddress ipAddress, int portNumber)
		throws IOException
	{
		this.buffer = ByteBuffer.allocate(1400);
		this.buffer.order(ByteOrder.LITTLE_ENDIAN);
		
		this.channel = DatagramChannel.open();
		this.channel.connect(new InetSocketAddress(ipAddress, portNumber));
		this.channel.configureBlocking(false);
	}
	
	public SteamPacket getReply()
		throws IOException, Exception
	{
		Selector selector = Selector.open();
		this.channel.register(selector, SelectionKey.OP_READ);
		if(selector.select(1000) == 0)
		{
			throw new TimeoutException();
		}
		
		int bytesRead;
		byte[] packetData = new byte[0];
		
		SteamPacket packet;

		this.buffer = ByteBuffer.allocate(1400);
		bytesRead = this.channel.read(this.buffer);
		this.buffer.rewind();
		this.buffer.limit(bytesRead);
		
		if(this.buffer.getInt() == -2L)
		{
			byte[] splitData, tmpData;
			int packetCount, packetNumber;
			long requestId;
			short splitSize;
			
			do
			{
				requestId = this.buffer.getInt();
				packetCount = this.buffer.get();
{'fraction_non_alphanumeric': 0.11189801699716714, 'fraction_numerical': 0.0084985835694051, 'mean_word_length': 4.382621951219512, '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': '1361478', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1089, 'n_words': 241}