Zizalik

Writing

May 28th, 2018
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package eksam2018;
  7.  
  8. import java.io.File;
  9. import java.io.IOException;
  10. import java.text.SimpleDateFormat;
  11. import org.codehaus.jackson.map.ObjectMapper;
  12. import org.codehaus.jackson.map.SerializationConfig;
  13.  
  14. /**
  15. *
  16. * @author t166038
  17. */
  18. public class write {
  19. public static void write() throws IOException {
  20. ObjectMapper mapper = new ObjectMapper(); // mapperi maaramine
  21. mapper.enable(SerializationConfig.Feature.INDENT_OUTPUT); // teksti format
  22. mapper.setDateFormat(new SimpleDateFormat("dd.MM.yyyy"));
  23. String FNAME="salegoods.json"; // fail
  24. mapper.writeValue(new File(FNAME), Eksam2018.saleGoods); // faili sisse kirjutamine
  25. }
  26. }
Add Comment
Please, Sign In to add comment