This is the default implementation of RTF editing
functionality. The RTF support was not written by the
Swing team. In the future we hope to improve the support
provided.
| Method from javax.swing.text.rtf.RTFEditorKit Detail: |
public String getContentType() {
return "text/rtf";
}
Get the MIME type of the data that this
kit represents support for. This kit supports
the type text/rtf. |
public void read(InputStream in,
Document doc,
int pos) throws IOException, BadLocationException {
if (doc instanceof StyledDocument) {
// PENDING(prinz) this needs to be fixed to
// insert to the given position.
RTFReader rdr = new RTFReader((StyledDocument) doc);
rdr.readFromStream(in);
rdr.close();
} else {
// treat as text/plain
super.read(in, doc, pos);
}
}
Insert content from the given stream which is expected
to be in a format appropriate for this kind of content
handler. |
public void read(Reader in,
Document doc,
int pos) throws IOException, BadLocationException {
if (doc instanceof StyledDocument) {
RTFReader rdr = new RTFReader((StyledDocument) doc);
rdr.readFromReader(in);
rdr.close();
} else {
// treat as text/plain
super.read(in, doc, pos);
}
}
Insert content from the given stream, which will be
treated as plain text. |
public void write(OutputStream out,
Document doc,
int pos,
int len) throws IOException, BadLocationException {
// PENDING(prinz) this needs to be fixed to
// use the given document range.
RTFGenerator.writeDocument(doc, out);
}
Write content from a document to the given stream
in a format appropriate for this kind of content handler. |
public void write(Writer out,
Document doc,
int pos,
int len) throws IOException, BadLocationException {
throw new IOException("RTF is an 8-bit format");
}
Write content from a document to the given stream
as plain text. |