I have created a text file in a unix environment using java code.
To write a text file, I use java.io.FileWriter and BufferedWriter. and for a new line after each line, I use the bw.write ("\ r \ n") method. (where bw is the BufferedWriter object) and sending this text file by attaching the unix environment in the mail to other environments such as (mainframe, windows)
My problem: if my client uploads a text file in the Mainframe system, they find that the text file has a "special character" (for example, a small rectangular rectangle), the view and the data are not aligned correctly.
bw.write ("\ r \ n") does not work, I think so. (but works fine in windows).
I want the same text file alignment as in the unix environment, and without any special character symbol if they opened the text file in mainframe, Windows environments or any other environment.
How to solve the problem. Thank you for your help.
pasting my java code snippet here for reference .. (running java code in unix
environment)
File f = new File(strFileGenLoc);
BufferedWriter bw = new BufferedWriter(new FileWriter(f, false));
rs = stmt.executeQuery("select * from jpdata");
while ( rs.next() ) {
bw.write(rs.getString(1)==null? "":rs.getString(1));
bw.newLine();
}
source
share