/[classpath]/classpath/javax/swing/text/DefaultEditorKit.java
ViewVC logotype

Diff of /classpath/javax/swing/text/DefaultEditorKit.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by rabbit78, Tue Sep 13 23:44:50 2005 UTC revision 1.21 by abalkiss, Tue Sep 20 19:22:14 2005 UTC
# Line 947  public class DefaultEditorKit extends Ed Line 947  public class DefaultEditorKit extends Ed
947     * @param offset the beginning offset from where to write     * @param offset the beginning offset from where to write
948     * @param len the length of the fragment to write     * @param len the length of the fragment to write
949     *     *
950     * @throws BadLocationException if <code>offset</code> or     * @throws BadLocationException if <code>offset</code> is an
951     *         <code>offset + len</code>is an invalid location inside     * invalid location inside <code>document</code>.
    *         <code>document</code>  
952     * @throws IOException if something goes wrong while writing to     * @throws IOException if something goes wrong while writing to
953     *        <code>out</code>     *        <code>out</code>
954     */     */
955    public void write(Writer out, Document document, int offset, int len)    public void write(Writer out, Document document, int offset, int len)
956      throws BadLocationException, IOException        throws BadLocationException, IOException
957    {    {
958      // TODO: Implement this properly.      // Throw a BLE if offset is invalid
959        if (offset < 0 || offset > document.getLength())
960          throw new BadLocationException("Tried to write to invalid location",
961                                         offset);
962    
963        // If they gave an overly large len, just adjust it
964        if (offset + len > document.getLength())
965          len = document.getLength() - offset;
966    
967        out.write(document.getText(offset, len));
968    }    }
969  }  }

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26