home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-tomcat-addon-1.4.9-installer.exe / servlet-api.jar / javax / servlet / ServletInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-08-28  |  637 b   |  29 lines

  1. package javax.servlet;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. public abstract class ServletInputStream extends InputStream {
  7.    protected ServletInputStream() {
  8.    }
  9.  
  10.    public int readLine(byte[] b, int off, int len) throws IOException {
  11.       if (len <= 0) {
  12.          return 0;
  13.       } else {
  14.          int count = 0;
  15.  
  16.          int c;
  17.          while((c = this.read()) != -1) {
  18.             b[off++] = (byte)c;
  19.             ++count;
  20.             if (c == 10 || count == len) {
  21.                break;
  22.             }
  23.          }
  24.  
  25.          return count > 0 ? count : -1;
  26.       }
  27.    }
  28. }
  29.