001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.http.commons.responses;
007
008import java.io.IOException;
009import java.io.InputStream;
010
011import org.apache.commons.io.input.BoundedInputStream;
012
013/**
014 * An {@link InputStream} that skips bytes and only returns the data up to a certain limit
015 *
016 * @author awoods
017 * @author ajs6f
018 */
019public class RangeRequestInputStream extends BoundedInputStream {
020
021    /**
022     * @param in the underlying input stream, or <code>null</code> if
023     *           this instance is to be created without an underlying stream.
024     * @param skip the number of bytes to skip at the beginning of the stream
025     * @param length the number of bytes from the inputstream to read
026     * @throws IOException if IO exception occurred
027     */
028    public RangeRequestInputStream(final InputStream in, final long skip, final long length) throws IOException {
029        super(in, length);
030        in.skip(skip);
031    }
032}