1 46 47 package org.codehaus.groovy.control.io; 48 49 import java.io.File ; 50 import java.io.FileInputStream ; 51 import java.io.IOException ; 52 import java.io.InputStreamReader ; 53 import java.io.Reader ; 54 55 import org.codehaus.groovy.control.CompilerConfiguration; 56 57 58 65 66 public class FileReaderSource extends AbstractReaderSource 67 { 68 71 private File file; 73 74 77 78 public FileReaderSource( File file, CompilerConfiguration configuration ) 79 { 80 super( configuration ); 81 this.file = file; 82 } 83 84 85 86 89 90 public FileReaderSource( String path, CompilerConfiguration configuration ) 91 { 92 this( new File (path), configuration ); 93 } 94 95 96 97 100 101 public Reader getReader() throws IOException 102 { 103 return new InputStreamReader ( new FileInputStream (file), configuration.getSourceEncoding() ); 104 } 105 106 107 108 109 } 110 | Popular Tags |