Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrigé #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions src/main/java/com/openclassrooms/ideinstall/QuizExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,33 @@
import org.apache.commons.codec.binary.Base64;

import ij.IJ;
import ij.ImagePlus;

public class QuizExample {

public static void main(String[] args) throws IOException, InterruptedException {
final int compteARebours = 5;
System.out.println("Compte à rebours !")
for (int i = compteARebours; i <= compteARebours; i--) {
System.out.println("Compte à rebours !");
for (int i = compteARebours; i == 0; i--) {
System.out.println("--> " + i);
Thread.sleep(1000);
}
final Path cheminImage = cheminFichier(choixSecret());
final ImagePlus imp = IJ.openImage(cheminImage.toString());
imp.show();Files.delete(cheminImage);Files.delete(cheminImage.getParent());
imp.show();
Files.delete(cheminImage);
Files.delete(cheminImage.getParent());
}

public static String choixSecret() {return new String(Base64.decodeBase64("bGFwaW4="));}
public static String choixSecret() {
return new String(Base64.decodeBase64("bGFwaW4="));
}

public static Path cheminFichier(String image) throws IOException {
final String nomImage = image + ".jpg";
final Path tmpDir = Files.createTempDirectory(image);
final Path cheminFichier = tmpDir.resolve(nomImage);
Files.copy(QuizExample.class.getClassLoader().getResourceAsStream(nomImage), cheminFichier);
return cheminFichier;}
final String nomImage = image + ".jpg";
final Path tmpDir = Files.createTempDirectory(image);
final Path cheminFichier = tmpDir.resolve(nomImage);
Files.copy(QuizExample.class.getClassLoader().getResourceAsStream(nomImage), cheminFichier);
return cheminFichier;
}
}