public TorrentHandler(TorrentInfo torrentInfo, String outputFile){
		
		this.torrentInfo = torrentInfo;
		this.file = outputFile;
		this.pieces = new HashMap<Integer, Piece>();
		this.recieved = new boolean[this.torrentInfo.piece_hashes.length];
		
		for(int i = 0; i < this.torrentInfo.piece_hashes.length; i++){
			int length = this.torrentInfo.piece_length;
			if(i == this.torrentInfo.piece_hashes.length - 1){
				length = this.torrentInfo.file_length % this.torrentInfo.piece_length;
				if(length == 0){
					length = this.torrentInfo.piece_length;
				}
			}
			Piece p = new Piece(i, length, this.torrentInfo.piece_hashes[i].array());
			this.pieces.put(i, p);
		}
		
		//Check if the file exists, if it does, load the info
		Path path = Paths.get(file);
		if(Files.exists(path)){
			System.out.println("Loading file");
			loadFile();
		}
		
	}