| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException { |
| 73 | if ((pos < 0) || ((pos + len) > doc.getLength())) { |
| 74 | |
| 75 | throw new BadLocationException("DefaultEditorKit.write", pos); |
| 76 | } |
| 77 | |
| 78 | Segment data = new Segment(); |
| 79 | int nleft = len; |
| 80 | int offs = pos; |
| 81 | |
| 82 | while (nleft > 0) { |
| 83 | |
| 84 | int n = Math.min(nleft, 4096); |
| 85 | doc.getText(offs, n, data); |
| 86 | out.write(data.array, data.offset, data.count); |
| 87 | offs += n; |
| 88 | nleft -= n; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | class WrapColumnFactory implements ViewFactory { |
| 93 | |