/**
* © 2008 INA Service GmbH
*/
+
package net.pterodactylus.util.io;
import java.io.FilterInputStream;
/**
* A wrapper around an {@link InputStream} that only supplies a limit number of
* bytes from the underlying input stream.
- *
+ *
* @author <a href="mailto:dr@ina-germany.de">David Roden</a>
- * @version $Id$
*/
public class LimitedInputStream extends FilterInputStream {
/**
* Creates a new LimitedInputStream that supplies at most
* <code>length</code> bytes from the given input stream.
- *
+ *
* @param inputStream
* The input stream
* @param length
*/
@Override
public synchronized long skip(long n) throws IOException {
- if ((n < 0) || (remaining == 0)) {
+ if ((n < 0) || (remaining == 0)) {
return 0;
}
long skipped = super.skip(Math.min(n, remaining));
}
/**
- * {@inheritDoc}
- *
- * This method does nothing, as {@link #mark(int)} and {@link #reset()} are
- * not supported.
- *
+ * {@inheritDoc} This method does nothing, as {@link #mark(int)} and
+ * {@link #reset()} are not supported.
+ *
* @see java.io.FilterInputStream#mark(int)
*/
@Override
/**
* {@inheritDoc}
- *
+ *
* @see java.io.FilterInputStream#markSupported()
* @return <code>false</code>
*/
}
/**
- * {@inheritDoc}
- *
- * This method does nothing, as {@link #mark(int)} and {@link #reset()} are
- * not supported.
- *
+ * {@inheritDoc} This method does nothing, as {@link #mark(int)} and
+ * {@link #reset()} are not supported.
+ *
* @see java.io.FilterInputStream#reset()
*/
@Override
/**
* Consumes the input stream, i.e. read all bytes until the limit is
* reached.
- *
+ *
* @throws IOException
* if an I/O error occurs
*/