package my.steno;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class StenoUtils {

	private StenoUtils() {
	}

	/**
	 * Index to retreive hidden text.
	 */
	private static String INDEX = "@@@@@@";

	/**
	 * Hide the data contents inside the picture.
	 *
	 * @param picture
	 *            the picture
	 * @param text
	 *            the text
	 * @throws IOException
	 *             Signals that an I/O exception has occurred.
	 */
	public static void hideTextData(File picture, String text) throws IOException {
		try (FileOutputStream fos = new FileOutputStream(picture, true)) {

			byte[] encodedString = text.getBytes();

			fos.write(INDEX.getBytes());
			fos.write(encodedString);
			fos.close();
		} catch (Exception e) {
			System.err.println("FileName= " + picture.getName());
			throw new IllegalArgumentException(e);
		}
	}

	/**
	 * Get the hidden data from an picture.
	 *
	 * @param fileNameFullPath
	 *            the file name full path
	 * @return the hidden data
	 */
	public static String getHiddenData(String fileNameFullPath) {
		File file = new File(fileNameFullPath);
		if (!file.exists()) {
			throw new IllegalArgumentException("no file found");
		}
		try (InputStream inStream = new FileInputStream(file)) {

			byte[] fileData = new byte[(int) file.length()];
			inStream.read(fileData);
			inStream.close();

			String tempFileData = new String(fileData);

			return tempFileData.substring(tempFileData.indexOf(INDEX) + INDEX.length(), tempFileData.length());

		} catch (Exception e) {
			throw new IllegalArgumentException(e);
		}
	}

	/**
	 * Gets the pictures.
	 *
	 * @param directory
	 *            the directory
	 * @return the pictures
	 */
	public static List<File> getPictures(File directory) {
		// trie du dossier, pour avoir que les fichiers de type jpg.
		String[] fileName = directory.list((dir, name) -> name.endsWith(".jpg"));

		// transformation du tableau de string en list de fichier.
		// List<File> files = Stream.of(fileName).map(s -> new
		// File(s)).collect(Collectors.toList());
		return Stream.of(fileName).map(File::new).collect(Collectors.toList());
	}
}

@@ -1638,16 +1638,61 @@
 ta);%0D%0A%0D%0A
+%09%09%09if (tempFileData.indexOf(INDEX) %3E= 0) %7B%0D%0A%09
 %09%09%09retur
@@ -1782,24 +1782,49 @@
 .length());%0D
+%0A%09%09%09%7D%0D%0A%0D%0A%09%09%09return null;%0D
 %0A%0D%0A%09%09%7D catch
@@ -2282,29 +2282,14 @@
 %0D%0A%09%09
-// List%3CFile%3E files =
+return
  Str
@@ -2321,20 +2321,32 @@
  new
-%0D%0A%09%09//
  File(
+directory + %22/%22 + 
 s)).
@@ -2374,30 +2374,39 @@
 List());%0D%0A%09%09
+// 
 return
+%0D%0A%09%09//
  Stream.of(f

Update StenoUtils.java