Changeset 310 for trunk


Ignore:
Timestamp:
12/13/11 16:51:46 (13 years ago)
Author:
sherbold
Message:
  • now specifies character encoding of file explicitly instead of assuming default encoding
Location:
trunk/JavaHelperLib/src/de/ugoe/cs/util
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaHelperLib/src/de/ugoe/cs/util/FileTools.java

    r175 r310  
    22 
    33import java.io.File; 
     4import java.io.FileInputStream; 
    45import java.io.FileNotFoundException; 
    56import java.io.FileReader; 
    67import java.io.IOException; 
     8import java.io.InputStreamReader; 
     9import java.nio.charset.Charset; 
    710 
    811/** 
     
    5558                        boolean carriageReturn) throws IOException, FileNotFoundException { 
    5659                File f = new File(filename); 
    57                 FileReader reader = new FileReader(f); 
     60                FileInputStream fis = new FileInputStream(f); 
     61                InputStreamReader reader = new InputStreamReader(fis, 
     62                                Charset.defaultCharset()); 
    5863                char[] buffer = new char[(int) f.length()]; 
    5964                reader.read(buffer); 
  • trunk/JavaHelperLib/src/de/ugoe/cs/util/console/FileOutputListener.java

    r250 r310  
    11package de.ugoe.cs.util.console; 
    22 
     3import java.io.FileOutputStream; 
    34import java.io.FileWriter; 
    45import java.io.IOException; 
     6import java.io.OutputStreamWriter; 
    57 
    68import de.ugoe.cs.util.console.listener.IOutputListener; 
     
    3941         * </p> 
    4042         */ 
    41         FileWriter writer = null; 
     43        OutputStreamWriter writer = null; 
    4244 
    4345        /** 
     
    6264        public void start() { 
    6365                try { 
    64                         writer = new FileWriter(filename); 
     66                        FileOutputStream fos = new FileOutputStream(filename); 
     67                        writer = new OutputStreamWriter(fos, "UTF-8"); 
    6568                        Console.getInstance().registerOutputListener(this); 
    6669                } catch (IOException e) { 
  • trunk/JavaHelperLib/src/de/ugoe/cs/util/console/defaultcommands/CMDexec.java

    r244 r310  
    22 
    33import java.io.File; 
     4import java.io.FileInputStream; 
    45import java.io.FileNotFoundException; 
    56import java.io.FileReader; 
    67import java.io.IOException; 
     8import java.io.InputStreamReader; 
    79import java.security.InvalidParameterException; 
    810import java.util.List; 
     
    3840                        String[] commands; 
    3941                        File f = new File(script); 
    40                         FileReader reader = new FileReader(f); 
     42                        FileInputStream fis = new FileInputStream(f); 
     43                        InputStreamReader reader = new InputStreamReader(fis, "UTF-8"); 
    4144                        char[] buffer = new char[(int) f.length()]; 
    4245                        reader.read(buffer); 
Note: See TracChangeset for help on using the changeset viewer.