BufferedReader reader = new BufferedReader(in);  String line; StringBuffer content = new StringBuffer();  while ((line = reader.readLine()) != null) { content.append(line); content.append("\n"); }  document.insertString(offset, content.toString(), SimpleAttributeSet.EMPTY);
read(new InputStreamReader(in), document, offset);
  public void read(Reader in, Document document, int offset)    throws BadLocationException, IOException    {    BufferedReader reader = new BufferedReader(in);    String line;    StringBuffer content = new StringBuffer();    while ((line = reader.readLine()) != null)      {      content.append(line);	content.append("\n");      }        document.insertString(offset, content.toString(),			  SimpleAttributeSet.EMPTY);    }