Annotation of java/classes/org/w3c/jigsaw/servlet/JigsawServletInputStream.java, revision 1.1
1.1 ! abaird 1: // JigsawServletInputStream.java
! 2: // $Id: Request.java,v 1.18 1996/11/25 17:26:30 abaird Exp $
! 3: // (c) COPYRIGHT MIT and INRIA, 1996.
! 4: // Please first read the full copyright statement in file COPYRIGHT.html
! 5:
! 6:
! 7: package w3c.jigsaw.servlet;
! 8:
! 9: import java.io.*;
! 10: import java.servlet.*;
! 11:
! 12: class JigsawServletInputStream extends ServletInputStream {
! 13: InputStream in = null;
! 14:
! 15: public int read()
! 16: throws IOException
! 17: {
! 18: return in.read();
! 19: }
! 20:
! 21: public int read(byte b[])
! 22: throws IOException
! 23: {
! 24: return in.read(b, 0, b.length);
! 25: }
! 26:
! 27: public int read(byte b[], int off, int len)
! 28: throws IOException
! 29: {
! 30: return in.read(b, off, len);
! 31: }
! 32:
! 33: public long skip(long n)
! 34: throws IOException
! 35: {
! 36: return in.skip(n);
! 37: }
! 38:
! 39: public int available()
! 40: throws IOException
! 41: {
! 42: return in.available();
! 43: }
! 44:
! 45: public void close()
! 46: throws IOException
! 47: {
! 48: in.close();
! 49: }
! 50:
! 51: public synchronized void mark(int readlimit) {
! 52: in.mark(readlimit);
! 53: }
! 54:
! 55: public synchronized void reset()
! 56: throws IOException
! 57: {
! 58: in.reset();
! 59: }
! 60:
! 61: public boolean markSupported() {
! 62: return in.markSupported();
! 63: }
! 64:
! 65: public int readLine(byte b[], int off, int len)
! 66: throws IOException
! 67: {
! 68: int got = 0;
! 69: while (got < len) {
! 70: int ch = in.read();
! 71: switch(ch) {
! 72: case -1:
! 73: return -1;
! 74: case '\r':
! 75: case '\n':
! 76: in.mark(1);
! 77: if ((ch = in.read()) != '\n' )
! 78: in.reset();
! 79: return got;
! 80: default:
! 81: b[off+got] = (byte) ch;
! 82: got++;
! 83: }
! 84: }
! 85: return got;
! 86: }
! 87:
! 88: JigsawServletInputStream(InputStream in) {
! 89: this.in = in;
! 90: }
! 91:
! 92:
! 93: }
! 94:
Webmaster