public static String getSourceByClass ( Class < ? > koanClass ) { File file = new File ( getKoanFileLocation ( koanClass ) ) ; StringBuilder contents = new StringBuilder ( ) ; BufferedReader reader = null ; try { reader = new BufferedReader ( new FileReader ( file ) ) ; String text = null ; while ( ( text = reader . readLine ( ) ) != null ) { contents . append ( text ) . append ( System . lineSeparator ( ) ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { try { if ( reader != null ) { reader . close ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } return contents . toString ( ) ; }
Gets source for a class .