Ignore:
Timestamp:
05/17/11 15:40:16 (14 years ago)
Author:
sherbold
Message:
  • fixed bug regarding encoding of XML files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/ReplayGenerator.java

    r1 r44  
    22 
    33import java.io.File; 
    4 import java.io.FileWriter; 
     4import java.io.FileOutputStream; 
    55import java.io.IOException; 
     6import java.io.OutputStreamWriter; 
    67import java.util.List; 
    78 
     
    1415                 
    1516        public void createLogfileMultipleSessions(List<List<ReplayableEvent<?>>> sequences, String filename) { 
    16                 FileWriter writer = openReplayFile(filename); 
     17                OutputStreamWriter writer = openReplayFile(filename); 
    1718                if( writer!=null ) {             
    1819                        try { 
    19                                 writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE); 
     20                                writer.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 
    2021                                writer.write("<log>" + StringTools.ENDLINE); 
    2122 
     
    3334         
    3435        public void createLogfileSingleSession(List<ReplayableEvent<?>> actions, String filename) { 
    35                 FileWriter writer = openReplayFile(filename); 
     36                OutputStreamWriter writer = openReplayFile(filename); 
    3637                if( writer!=null ) {             
    3738                        try { 
    38                                 writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + StringTools.ENDLINE); 
     39                                writer.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 
    3940                                writer.write("<log>" + StringTools.ENDLINE); 
    4041         
     
    4950        } 
    5051 
    51         private FileWriter openReplayFile(String filename) { 
     52        private OutputStreamWriter openReplayFile(String filename) { 
    5253                File file = new File(filename); 
    5354                boolean fileCreated; 
     
    6364                        Console.printStacktrace(e); 
    6465                } 
    65                 FileWriter writer = null; 
     66                OutputStreamWriter writer = null; 
    6667                try { 
    67                         writer = new FileWriter(file); 
     68                        writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-16"); 
    6869                } catch (IOException e) { 
    6970                        Console.printerrln("Unable to open file for writing (read-only file):" + filename); 
     
    7374        } 
    7475         
    75         private void writeSession(List<ReplayableEvent<?>> actions, FileWriter writer) 
     76        private void writeSession(List<ReplayableEvent<?>> actions, OutputStreamWriter writer) 
    7677                        throws IOException { 
    7778                writer.write(" <session>" + StringTools.ENDLINE); 
Note: See TracChangeset for help on using the changeset viewer.