// File Read Write on Note Txt File //
File file = new File (filePath);
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
while(br.readLine() != null){
String data = br.readLine();
System.out.println(data);
}
br.close();
File file = new File(filePath);
FileWriter fw = new FileWriter(file);
BufferedWriter bw = new BufferedWriter(fw);
bw.writeLine("Hello");
bw.newLine();
bw.writeLine("World");
bw.close();
// File Write Feature //
FileInputStream fis = new FileInputStream(filePath);
Workbook wb = WorkbookFactory.create(fis);
Sheet sh = wb.getSheet("SheetName);
Row rw = sh.getRow(1);
Cell cl = rw.getCell(1);
String data = cl.getStringCellValue();
int data = cl.getNumCellValue();
// File Write Feature //
FileInputStream fis = new FileInputSteam(filePath);
Workbook wb = WorkbookFactory.create(fis);
Sheet sh = wb.getSheet("Sheetname");
Row rw = sh.getRow(1);
if(rw == null ){
rw = sh.createRow(1);
}
Cell cl = rw.getCell(1);
if( cl == null){
cl = rw.createCell(1);
}
cl.setCellValue("Hello World");
FileOutputStream fos = new FileOutputStream(filePath);
wb.write(fos);
fos.close();
Comments
Post a Comment