<commit_before>package org.hugonikanor.imageStitcher.fileReader;

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FileSystemAccess {

	private File dir;

	public FileSystemAccess( File dir ) {

		this.dir = dir;

		// This may be null
		// it also isn't sorted in any way
		dir.listFiles();

	}

	/**
	 * TODO this should take a filter
	 */
	public BufferedImage[] getImages() {

		File[] unfilteredFiles = dir.listFiles();
		List<File> filteredFiles = new ArrayList<>();
		for( File f : unfilteredFiles ) {
			if( !f.isDirectory() ) {
				filteredFiles.add( f );
			}
		}

		List<BufferedImage> images =
			new FileReader( filteredFiles.toArray(new File[filteredFiles.size()]) ).readImages();

		return images.toArray(new BufferedImage[images.size()]);
	}

	/**
	 * @return the dir
	 */
	public File getDir() {
		return dir;
	}
}<commit_msg>FileSystemAccess now has writeImage method<commit_after>package org.hugonikanor.imageStitcher.fileReader;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.imageio.ImageIO;

public class FileSystemAccess {

	private File dir;

	public FileSystemAccess( File dir ) {

		this.dir = dir;

		// This may be null
		// it also isn't sorted in any way
		dir.listFiles();

	}

	/**
	 * TODO this should take a filter
	 */
	public BufferedImage[] getImages() {

		File[] unfilteredFiles = dir.listFiles();
		List<File> filteredFiles = new ArrayList<>();
		for( File f : unfilteredFiles ) {
			if( !f.isDirectory() ) {
				filteredFiles.add( f );
			}
		}

		List<BufferedImage> images =
			new FileReader( filteredFiles.toArray(new File[filteredFiles.size()]) ).readImages();

		return images.toArray(new BufferedImage[images.size()]);
	}

	public void writeImage( BufferedImage image, String filename ) 
		throws IOException {
		ImageIO.write( image, "png", new File(filename.concat(".png")) );
	}

	/**
	 * @return the dir
	 */
	public File getDir() {
		return dir;
	}
}
{'fraction_non_alphanumeric': 0.1292026897214217, 'fraction_numerical': 0.0, 'mean_word_length': 3.744874715261959, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4047381', 'n_tokens_mistral': 746, 'n_tokens_neox': 662, 'n_words': 174}