question: public static String readTextFile ( File file ) throws IOException { FileInputStream inStream = new FileInputStream ( file ) ; boolean useFallback = false ; try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder documentBuilder = documentBuilderFactory . newDocumentBuilder ( ) ; Document processXmlDocument = documentBuilder . parse ( inStream ) ; XPathFactory xPathFactory = XPathFactory . newInstance ( ) ; XPath xPath = xPathFactory . newXPath ( ) ; String versionString = xPath . evaluate ( "/process/@version" , processXmlDocument ) ; VersionNumber version = new VersionNumber ( versionString ) ; if ( version . isAtMost ( 5 , 2 , 8 ) ) { useFallback = true ; } } catch ( XPathExpressionException e ) { useFallback = true ; } catch ( SAXException e ) { useFallback = true ; } catch ( ParserConfigurationException e ) { useFallback = true ; } catch ( IOException e ) { useFallback = true ; } catch ( NumberFormatException e ) { useFallback = true ; } InputStreamReader reader = null ; try { inStream = new FileInputStream ( file ) ; if ( useFallback ) { reader = new InputStreamReader ( inStream ) ; } else { reader = new InputStreamReader ( inStream , XMLImporter . PROCESS_FILE_CHARSET ) ; } return readTextFile ( reader ) ; } finally { try { inStream . close ( ) ; } catch ( IOException e ) { } if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { } } } }
target:  Reads a text file into a single string. Process files created with RapidMiner 5.2.008 or earlier will be read with the system encoding (for compatibility reasons); all other files will be read with UTF-8 encoding.