title: Java: problem with reading a file
body: <p>I'm loading an XML file with this method:</p>
  
  <pre><code>public static String readTextFile(String fullPathFilename) throws IOException {
          StringBuffer sb = new StringBuffer(1024);
          BufferedReader reader = new BufferedReader(new FileReader(fullPathFilename));
  
          char[] chars = new char[1024];
          while(reader.read(chars) &gt; -1){
              sb.append(String.valueOf(chars));   
          }
  
          reader.close();
  
          return sb.toString();
      }
  </code></pre>
  
  <p>But it doesn't load the whole data. Instead of 25634 characters, it loads 10 less (25624). Why is that?</p>
  
  <p>Thanks,</p>
  
  <p>Ivan</p>