I am trying to generate a texlipse file with the help of BufferedReader
to read another texlipse file and write into the texlipse file to be generated using BufferedWriter
and in this process I am printing the content read by the BufferedReader
to console also. In doing so I am not able to read some characters like \u
, \b
, \v
, and I cannot neglect those as my texlipse need those while writing latex code.
package jchart2Dt;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
public class practice3 {
public static BufferedWriter bw;
static String sensitivity = "0.556";
static String offset = "0.125";
public static void main(String[]args) throws NullPointerException{
String pathname = "D:\\Messdaten\\CalibrationCertificate\\document.tex";
File file = new File(pathname);
InitialiseWriter();
try{
FileReader f = new FileReader(file);
BufferedReader br= new BufferedReader(f);
while(br.readLine()!= null){
String content = br.readLine();
System.out.println(content);
content = check(content);
WriteCertificate(content);
}
bw.close();
f.close();
}catch(Exception e){
e.printStackTrace();
}
}
public static void InitialiseWriter() {
// TODO Auto-generated method stub
File file = new File ("D:\\Messdaten\\CalibrationCertificate\\certificate.tex");
try {
if(!file.exists()){
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
bw=new BufferedWriter(fw);
} catch (Exception e) {}
}
public static String check(String line_content) {
String output = line_content.replace("<<sensitivity>>", sensitivity);
output = output.replace("<<offset>>", offset);
return output;
}
public static void WriteCertificate(String content) {
try{
bw.write(content +"\n");
}catch(Exception e){}
}
}