home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / text / rtf / RTFEditorKit.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  1.4 KB  |  44 lines

  1. package javax.swing.text.rtf;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import java.io.OutputStream;
  6. import java.io.Reader;
  7. import java.io.Writer;
  8. import javax.swing.text.BadLocationException;
  9. import javax.swing.text.Document;
  10. import javax.swing.text.StyledDocument;
  11. import javax.swing.text.StyledEditorKit;
  12.  
  13. public class RTFEditorKit extends StyledEditorKit {
  14.    public Object clone() {
  15.       return new RTFEditorKit();
  16.    }
  17.  
  18.    public String getContentType() {
  19.       return "text/rtf";
  20.    }
  21.  
  22.    public void read(InputStream var1, Document var2, int var3) throws IOException, BadLocationException {
  23.       if (var2 instanceof StyledDocument) {
  24.          RTFReader var4 = new RTFReader((StyledDocument)var2);
  25.          ((AbstractFilter)var4).readFromStream(var1);
  26.          var4.close();
  27.       } else {
  28.          throw new IOException("Document must be StyledDocument");
  29.       }
  30.    }
  31.  
  32.    public void read(Reader var1, Document var2, int var3) throws IOException, BadLocationException {
  33.       throw new IOException("RTF is an 8-bit format");
  34.    }
  35.  
  36.    public void write(OutputStream var1, Document var2, int var3, int var4) throws IOException, BadLocationException {
  37.       RTFGenerator.writeDocument(var2, var1);
  38.    }
  39.  
  40.    public void write(Writer var1, Document var2, int var3, int var4) throws IOException, BadLocationException {
  41.       throw new IOException("RTF is an 8-bit format");
  42.    }
  43. }
  44.