001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.io.unsync;
016    
017    import java.io.IOException;
018    
019    import javax.servlet.ServletInputStream;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class UnsyncByteArrayInputStreamWrapper extends ServletInputStream {
025    
026            public UnsyncByteArrayInputStreamWrapper(
027                    UnsyncByteArrayInputStream unsyncByteArrayInputStream) {
028    
029                    _unsyncByteArrayInputStream = unsyncByteArrayInputStream;
030            }
031    
032            @Override
033            public int available() {
034                    return _unsyncByteArrayInputStream.available();
035            }
036    
037            @Override
038            public void close() throws IOException {
039                    _unsyncByteArrayInputStream.close();
040            }
041    
042            @Override
043            public void mark(int readLimit) {
044                    _unsyncByteArrayInputStream.mark(readLimit);
045            }
046    
047            @Override
048            public boolean markSupported() {
049                    return _unsyncByteArrayInputStream.markSupported();
050            }
051    
052            @Override
053            public int read() {
054                    return _unsyncByteArrayInputStream.read();
055            }
056    
057            @Override
058            public int read(byte[] bytes) {
059                    return _unsyncByteArrayInputStream.read(bytes);
060            }
061    
062            @Override
063            public int read(byte[] bytes, int offset, int length) {
064                    return _unsyncByteArrayInputStream.read(bytes, offset, length);
065            }
066    
067            @Override
068            public int readLine(byte[] bytes, int offset, int length) {
069                    return _unsyncByteArrayInputStream.read(bytes, offset, length);
070            }
071    
072            @Override
073            public void reset() {
074                    _unsyncByteArrayInputStream.reset();
075            }
076    
077            @Override
078            public long skip(long skip) {
079                    return _unsyncByteArrayInputStream.skip(skip);
080            }
081    
082            private UnsyncByteArrayInputStream _unsyncByteArrayInputStream;
083    
084    }