home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / rockridge / getStarted / content / example / plain.java < prev    next >
Encoding:
Java Source  |  1995-11-13  |  651 b   |  25 lines

  1. /*
  2.  * Plain text file handler
  3.  */
  4. package net.www.content.text;
  5. import net.www.html.ContentHandler;
  6. import net.www.html.URL;
  7. import java.io.InputStream;
  8. import awt.GifImage;
  9.  
  10. public class plain extends ContentHandler {
  11.     public Object getContent(InputStream is, URL u) {
  12.     StringBuffer sb = new StringBuffer();
  13.     int c;
  14.  
  15.     while ((c = is.read()) >= 0) {
  16.         sb.appendChar(c);
  17.     }
  18.     sb.append("\n\n-- This closing message brought to you by your plain/text\n");
  19.     sb.append("content handler. To remove this content handler, delete the\n");
  20.     sb.append("net.www.content.text.plain class from your class path.\n");
  21.     is.close();
  22.     return sb.toString();
  23.     }
  24. }
  25.