home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / text / rtf / RTFEditorKit.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.6 KB  |  44 lines

  1. package com.sun.java.swing.text.rtf;
  2.  
  3. import com.sun.java.swing.text.BadLocationException;
  4. import com.sun.java.swing.text.Document;
  5. import com.sun.java.swing.text.StyledDocument;
  6. import com.sun.java.swing.text.StyledEditorKit;
  7. import java.io.IOException;
  8. import java.io.InputStream;
  9. import java.io.OutputStream;
  10. import java.io.Reader;
  11. import java.io.Writer;
  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 write(OutputStream var1, Document var2, int var3, int var4) throws IOException, BadLocationException {
  33.       RTFGenerator.writeDocument(var2, var1);
  34.    }
  35.  
  36.    public void read(Reader var1, Document var2, int var3) throws IOException, BadLocationException {
  37.       throw new IOException("RTF is an 8-bit format");
  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.