home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML in Action / Dynamicke-HTML-v-akci-covermount.bin / XML / PARSER / XMLINST.EXE / classes / com / ms / xml / util / StringInputStream.java < prev    next >
Encoding:
Java Source  |  1997-10-17  |  491 b   |  32 lines

  1. /*
  2.  * @(#)XMLInputStream.java 1.0 6/10/97
  3.  * 
  4.  * Copyright (c) 1997 Microsoft, Corp. All Rights Reserved.
  5.  * 
  6.  */
  7. package com.ms.xml.util;
  8.  
  9. import java.io.*;
  10.  
  11. public class StringInputStream extends InputStream
  12. {
  13.  
  14.     public StringInputStream(String text)
  15.     {
  16.         size = text.length();
  17.         index = 0;
  18.         buf = text;
  19.     }
  20.  
  21.     public int read() throws IOException
  22.     {
  23.         if (index < size)
  24.             return buf.charAt(index++);
  25.         return -1;
  26.     }
  27.  
  28.     int size;
  29.     int index;
  30.     String buf;
  31. }
  32.