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 / http / NoBodyOutputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-08-28  |  1.2 KB  |  29 lines

  1. package javax.servlet.http;
  2.  
  3. import java.io.IOException;
  4. import java.util.ResourceBundle;
  5. import javax.servlet.ServletOutputStream;
  6.  
  7. class NoBodyOutputStream extends ServletOutputStream {
  8.    private static final String LSTRING_FILE = "javax.servlet.http.LocalStrings";
  9.    private static ResourceBundle lStrings = ResourceBundle.getBundle("javax.servlet.http.LocalStrings");
  10.    private int contentLength = 0;
  11.  
  12.    int getContentLength() {
  13.       return this.contentLength;
  14.    }
  15.  
  16.    public void write(int b) {
  17.       ++this.contentLength;
  18.    }
  19.  
  20.    public void write(byte[] buf, int offset, int len) throws IOException {
  21.       if (len >= 0) {
  22.          this.contentLength += len;
  23.       } else {
  24.          String msg = lStrings.getString("err.io.negativelength");
  25.          throw new IOException("negative length");
  26.       }
  27.    }
  28. }
  29.