001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.util.servlet;
016    
017    import java.io.ByteArrayInputStream;
018    import java.io.IOException;
019    
020    import javax.servlet.ServletInputStream;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class ByteArrayInputStreamWrapper extends ServletInputStream {
026    
027            public ByteArrayInputStreamWrapper(
028                    ByteArrayInputStream byteArrayInputStream) {
029    
030                    _byteArrayInputStream = byteArrayInputStream;
031            }
032    
033            public int available() {
034                    return _byteArrayInputStream.available();
035            }
036    
037            public void close() throws IOException {
038                    _byteArrayInputStream.close();
039            }
040    
041            public void mark(int readLimit) {
042                    _byteArrayInputStream.mark(readLimit);
043            }
044    
045            public boolean markSupported() {
046                    return _byteArrayInputStream.markSupported();
047            }
048    
049            public int read() {
050                    return _byteArrayInputStream.read();
051            }
052    
053            public int read(byte[] byteArray) throws IOException {
054                    return _byteArrayInputStream.read(byteArray);
055            }
056    
057            public int read(byte[] byteArray, int offset, int length) {
058                    return _byteArrayInputStream.read(byteArray, offset, length);
059            }
060    
061            public int readLine(byte[] byteArray, int offset, int length) {
062                    return _byteArrayInputStream.read(byteArray, offset, length);
063            }
064    
065            public void reset() {
066                    _byteArrayInputStream.reset();
067            }
068    
069            public long skip(long skip) {
070                    return _byteArrayInputStream.skip(skip);
071            }
072    
073            private ByteArrayInputStream _byteArrayInputStream;
074    
075    }