001 /* 002 * Copyright (c) 2007 Mozilla Foundation 003 * 004 * Permission is hereby granted, free of charge, to any person obtaining a 005 * copy of this software and associated documentation files (the "Software"), 006 * to deal in the Software without restriction, including without limitation 007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 008 * and/or sell copies of the Software, and to permit persons to whom the 009 * Software is furnished to do so, subject to the following conditions: 010 * 011 * The above copyright notice and this permission notice shall be included in 012 * all copies or substantial portions of the Software. 013 * 014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 017 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 019 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 020 * DEALINGS IN THE SOFTWARE. 021 */ 022 023 package nu.validator.servletfilter; 024 025 import java.io.IOException; 026 import java.io.InputStream; 027 028 import javax.servlet.ServletInputStream; 029 030 public final class DelegatingServletInputStream extends ServletInputStream { 031 032 private final InputStream delegate; 033 034 public DelegatingServletInputStream(InputStream delegate) { 035 this.delegate = delegate; 036 } 037 038 /** 039 * @return 040 * @throws IOException 041 * @see java.io.InputStream#available() 042 */ 043 public int available() throws IOException { 044 return delegate.available(); 045 } 046 047 /** 048 * @throws IOException 049 * @see java.io.InputStream#close() 050 */ 051 public void close() throws IOException { 052 delegate.close(); 053 } 054 055 /** 056 * @param obj 057 * @return 058 * @see java.lang.Object#equals(java.lang.Object) 059 */ 060 public boolean equals(Object obj) { 061 return delegate.equals(obj); 062 } 063 064 /** 065 * @return 066 * @see java.lang.Object#hashCode() 067 */ 068 public int hashCode() { 069 return delegate.hashCode(); 070 } 071 072 /** 073 * @param readlimit 074 * @see java.io.InputStream#mark(int) 075 */ 076 public void mark(int readlimit) { 077 delegate.mark(readlimit); 078 } 079 080 /** 081 * @return 082 * @see java.io.InputStream#markSupported() 083 */ 084 public boolean markSupported() { 085 return delegate.markSupported(); 086 } 087 088 /** 089 * @return 090 * @throws IOException 091 * @see java.io.InputStream#read() 092 */ 093 public int read() throws IOException { 094 return delegate.read(); 095 } 096 097 /** 098 * @param b 099 * @param off 100 * @param len 101 * @return 102 * @throws IOException 103 * @see java.io.InputStream#read(byte[], int, int) 104 */ 105 public int read(byte[] b, int off, int len) throws IOException { 106 return delegate.read(b, off, len); 107 } 108 109 /** 110 * @param b 111 * @return 112 * @throws IOException 113 * @see java.io.InputStream#read(byte[]) 114 */ 115 public int read(byte[] b) throws IOException { 116 return delegate.read(b); 117 } 118 119 /** 120 * @throws IOException 121 * @see java.io.InputStream#reset() 122 */ 123 public void reset() throws IOException { 124 delegate.reset(); 125 } 126 127 /** 128 * @param n 129 * @return 130 * @throws IOException 131 * @see java.io.InputStream#skip(long) 132 */ 133 public long skip(long n) throws IOException { 134 return delegate.skip(n); 135 } 136 137 /** 138 * @return 139 * @see java.lang.Object#toString() 140 */ 141 public String toString() { 142 return delegate.toString(); 143 } 144 145 146 }