KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ajp > tomcat4 > Ajp13InputStream


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.ajp.tomcat4;
18
19 import java.io.IOException JavaDoc;
20
21 import javax.servlet.ServletInputStream JavaDoc;
22
23 import org.apache.ajp.Ajp13;
24
25 public class Ajp13InputStream extends ServletInputStream JavaDoc {
26
27     private Ajp13 ajp13;
28
29     Ajp13InputStream(Ajp13 ajp13) {
30         this.ajp13 = ajp13;
31     }
32
33     public int available() throws IOException JavaDoc {
34         return ajp13.available();
35     }
36
37     public void close() throws IOException JavaDoc {
38     }
39
40     public void mark(int readLimit) {
41     }
42
43     public boolean markSupported() {
44         return false;
45     }
46
47     public void reset() throws IOException JavaDoc {
48         throw new IOException JavaDoc("reset() not supported");
49     }
50
51     public int read() throws IOException JavaDoc {
52         return ajp13.doRead();
53     }
54
55     public int read(byte[] b, int off, int len) throws IOException JavaDoc {
56         return ajp13.doRead(b, off, len);
57     }
58
59     public long skip(long n) throws IOException JavaDoc {
60         if (n > Integer.MAX_VALUE) {
61             throw new IOException JavaDoc("can't skip than many: " + n);
62         }
63         byte[] b = new byte[(int)n];
64         return ajp13.doRead(b, 0, b.length);
65     }
66 }
67
Popular Tags