code: public static InputStream getBoundedStream(final InputStream stream, final int from, final int to)
              throws IOException {
          final long skipped = stream.skip(from);
          LOGGER.debug("Skipped {} bytes", skipped);
          return new BoundedInputStream(stream, (long) to - from);
      }
docs: Get a bounded inputstream.
  @param stream the input stream
  @param from the byte from which to start
  @param to the byte to which to read
  @throws IOException if an error occurs when skipping forward
  @return the bounded inputstream