Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class CSVWriter {
- public static void writeDataLineByLine(String filePath) {
- // first create file object for file placed at location
- // specified by filepath
- File file = new File(filePath);
- try {
- // create FileWriter object with file as parameter
- FileWriter writer = new FileWriter(file);
- // closing writer connection
- writer.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public void writePersonal(String filePath, String value) {
- // first create file object for file placed at location
- // specified by filepath
- File file = new File(filePath);
- String comma = ",";
- try {
- // create FileWriter object with file as parameter
- FileWriter writer = new FileWriter(file, true);
- writer.append("','");
- writer.append(value + ", ");
- // writer.write(str);
- writer.flush();
- writer.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement