Code example for FileReader

  protected CompilationResult compile(File lessFile, File cssOutput) throws Less4jException {
    try { 
      String less = IOUtils.toString(new FileReader(lessFile));
      LessCompiler compiler = getCompiler();
      Configuration configuration = createConfiguration(cssOutput);
      CompilationResult actual = compiler.compile(new StringSource(less), configuration);
      return actual;
    } catch (IOException ex) {
      throw new RuntimeException("Can not read less file " + lessFile.getName(), ex);
  protected void assertSourceMapValid(CompilationResult actual) {
    //source map: turned off the test. Source map is incorrect when original less file name is unknown and source map validator is not ready for that.  
    //It would be much better, if I would add less as "source content" property in that case, but it is not done as of now.   
Connect your IDE to all the code out there  Get Codota for Java