Guest User

Untitled

a guest
Oct 18th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. public void newTree(int x, int y){
  2.  
  3.  
  4. File f = new File("tree_"+ x +"_"+y+ ".txt");
  5.  
  6.  
  7. try {
  8. if(!f.exists()){
  9. oos = new ObjectOutputStream(
  10. new BufferedOutputStream(
  11. new FileOutputStream(
  12. new File("game.txt"))));
  13.  
  14.  
  15. for (int i = 0;i < 40 ; i++){
  16.  
  17.  
  18.  
  19.  
  20.  
  21. //Nous allons �crire chaque objet Game dans le fichier
  22. oos.writeObject(new Game(41 ,i, 1,5,1,20,1));
  23.  
  24.  
  25.  
  26.  
  27.  
  28. }
  29. //NE PAS OUBLIER DE FERMER LE FLUX ! ! !
  30. oos.close();
  31. }
  32. //On r�cup�re maintenant les donn�es !
  33.  
  34. //On r�cup�re maintenant les donn�es !
  35. TreeRead tree = new TreeRead();
  36. tree.treeRead();
  37.  
  38. } catch (FileNotFoundException e) {
  39. e.printStackTrace();
  40. } catch (IOException e) {
  41. e.printStackTrace();
  42. }
Add Comment
Please, Sign In to add comment