Changeset 44 for trunk/EventBenchConsole/src
- Timestamp:
- 05/17/11 15:40:16 (14 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/LogPreprocessor.java
r1 r44 3 3 import java.io.File; 4 4 import java.io.FileNotFoundException; 5 import java.io.FileOutputStream; 5 6 import java.io.FileReader; 6 import java.io.FileWriter;7 7 import java.io.IOException; 8 import java.io.OutputStreamWriter; 8 9 9 10 import org.apache.commons.codec.binary.Base64; … … 28 29 29 30 public void convertToXml(String source, String target) throws IOException, FileNotFoundException { 30 FileWriter targetFile = new FileWriter(target);31 targetFile.write("<?xml version=\"1.0\" encoding=\"UTF- 8\"?>" + StringTools.ENDLINE);31 OutputStreamWriter targetFile = new OutputStreamWriter(new FileOutputStream(target), "UTF-16"); 32 targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 32 33 targetFile.write("<log>" + StringTools.ENDLINE); 33 34 processFile(source, targetFile); … … 41 42 42 43 public void convertDirToXml(String path, String target) throws IOException, FileNotFoundException { 43 FileWriter targetFile = new FileWriter(target);44 targetFile.write("<?xml version=\"1.0\" encoding=\"UTF- 8\"?>" + StringTools.ENDLINE);44 OutputStreamWriter targetFile = new OutputStreamWriter(new FileOutputStream(target), "UTF-16"); 45 targetFile.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + StringTools.ENDLINE); 45 46 targetFile.write("<log>" + StringTools.ENDLINE); 46 47 File folder = new File(path); … … 62 63 } 63 64 64 private void processFile(String source, FileWriter targetFile)65 private void processFile(String source, OutputStreamWriter targetFile) 65 66 throws FileNotFoundException, IOException { 66 67 File f = new File(source); -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/ReplayGenerator.java
r1 r44 2 2 3 3 import java.io.File; 4 import java.io.File Writer;4 import java.io.FileOutputStream; 5 5 import java.io.IOException; 6 import java.io.OutputStreamWriter; 6 7 import java.util.List; 7 8 … … 14 15 15 16 public void createLogfileMultipleSessions(List<List<ReplayableEvent<?>>> sequences, String filename) { 16 FileWriter writer = openReplayFile(filename);17 OutputStreamWriter writer = openReplayFile(filename); 17 18 if( writer!=null ) { 18 19 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); 20 21 writer.write("<log>" + StringTools.ENDLINE); 21 22 … … 33 34 34 35 public void createLogfileSingleSession(List<ReplayableEvent<?>> actions, String filename) { 35 FileWriter writer = openReplayFile(filename);36 OutputStreamWriter writer = openReplayFile(filename); 36 37 if( writer!=null ) { 37 38 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); 39 40 writer.write("<log>" + StringTools.ENDLINE); 40 41 … … 49 50 } 50 51 51 private FileWriter openReplayFile(String filename) {52 private OutputStreamWriter openReplayFile(String filename) { 52 53 File file = new File(filename); 53 54 boolean fileCreated; … … 63 64 Console.printStacktrace(e); 64 65 } 65 FileWriter writer = null;66 OutputStreamWriter writer = null; 66 67 try { 67 writer = new FileWriter(file);68 writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-16"); 68 69 } catch (IOException e) { 69 70 Console.printerrln("Unable to open file for writing (read-only file):" + filename); … … 73 74 } 74 75 75 private void writeSession(List<ReplayableEvent<?>> actions, FileWriter writer)76 private void writeSession(List<ReplayableEvent<?>> actions, OutputStreamWriter writer) 76 77 throws IOException { 77 78 writer.write(" <session>" + StringTools.ENDLINE);
Note: See TracChangeset
for help on using the changeset viewer.