@Override
	public void handleFile(File file) {
		if (getProcessMode() == MODE_BIG_CHUNK) {
			String contents = FileTools.readFileToString(file, getOpenEncoding(), lineEnding);
			contents = processContents(file, contents);
			
			// If contents are null then don't write anything out.
			if (contents == null) {
				return;
			}
			
			// Clean last line ending if neccessary.
			int lineEndingLength = lineEnding.length();
			int contentsLength = contents.length();
			if (!lineEndingAtEnd && (contentsLength >= lineEndingLength)) {
				contents = contents.substring(0, contentsLength - lineEndingLength);
			}
			
			try {
				FileTools.dumpStringToFile(file, contents, getSaveEncoding());
			} catch (IOException ioe) {
				ioe.printStackTrace();
			}
		} else if (getProcessMode() == MODE_ARRAYS) {
			ArrayList lines = new ArrayList();
			ArrayList lineEndings = new ArrayList();
			FileTools.readFileToArrayOfLines(file, getOpenEncoding(), lines, lineEndings);
			
			boolean modified = processContents(file, lines, lineEndings);
			
			if (modified) {
				FileTools.dumpArrayOfLinesToFile(file, getSaveEncoding(), lines, lineEndings);
			}
		} else {
			System.out.println("Error: Unknown process mode.");
		}
	}