Hi
I wrote an
Servlet which gets an Path return this File as a Stream.Its workin fine but the formatiing get lost.This is very bad caus the file is an XML File and its very hard to read.
I'll post the Code from the Server and the Client
Server(my Servlet) :
<pre>
BufferedReader br = new BufferedReader(new FileReader(file));
PrintWriter pw = res.getWriter();
out = new BufferedWriter(pw);
String line;
while ((line = br.readLine()) != null) {
out.write(line);
}
br.close();
out.flush();
out.close();
Client(a Swing Client)
InputStreamReader isr = new InputStreamReader(in);
BufferedReader br = new BufferedReader(isr);
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
String line;
while ((line = br.readLine()) != null) {
writer.write(line);
writer.newLine();
}
writer.flush();
writer.close();
isr.close();
br.close();
</pre>
I find out that that at the Client side the readline is only once executed - that means the whole Stream was converted to one big String
Can anybody tell me how to avoid that - should i use another Writer/Reader ?
Thx,
Holger