1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.util.servlet;
16  
17  import java.io.ByteArrayInputStream;
18  import java.io.IOException;
19  
20  import javax.servlet.ServletInputStream;
21  
22  /**
23   * <a href="ByteArrayInputStreamWrapper.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class ByteArrayInputStreamWrapper extends ServletInputStream {
28  
29      public ByteArrayInputStreamWrapper(
30          ByteArrayInputStream byteArrayInputStream) {
31  
32          _byteArrayInputStream = byteArrayInputStream;
33      }
34  
35      public int available() {
36          return _byteArrayInputStream.available();
37      }
38  
39      public void close() throws IOException {
40          _byteArrayInputStream.close();
41      }
42  
43      public void mark(int readLimit) {
44          _byteArrayInputStream.mark(readLimit);
45      }
46  
47      public boolean markSupported() {
48          return _byteArrayInputStream.markSupported();
49      }
50  
51      public int read() {
52          return _byteArrayInputStream.read();
53      }
54  
55      public int read(byte[] byteArray) throws IOException {
56          return _byteArrayInputStream.read(byteArray);
57      }
58  
59      public int read(byte[] byteArray, int offset, int length) {
60          return _byteArrayInputStream.read(byteArray, offset, length);
61      }
62  
63      public int readLine(byte[] byteArray, int offset, int length) {
64          return _byteArrayInputStream.read(byteArray, offset, length);
65      }
66  
67      public void reset() {
68          _byteArrayInputStream.reset();
69      }
70  
71      public long skip(long skip) {
72          return _byteArrayInputStream.skip(skip);
73      }
74  
75      private ByteArrayInputStream _byteArrayInputStream;
76  
77  }