test_class.file: dubbo-common/src/test/java/com/alibaba/dubbo/common/io/StreamUtilsTest.java
test_class.identifier: StreamUtilsTest
test_case.body: @Test(expected = IndexOutOfBoundsException.class)
      public void testReadWithWrongOffset() throws IOException {
          InputStream is = StreamUtilsTest.class.getResourceAsStream("/StreamUtilsTest.txt");
          is = StreamUtils.limitedInputStream(is, 2);
          is.read(new byte[1], -1, 1);
      }
test_case.class_method_signature: StreamUtilsTest.testReadWithWrongOffset()
test_case.full_signature: @Test(expected = IndexOutOfBoundsException.class) public void testReadWithWrongOffset()
test_case.identifier: testReadWithWrongOffset
test_case.invocations: getResourceAsStream limitedInputStream read
test_case.modifiers: @Test(expected = IndexOutOfBoundsException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadWithWrongOffset()
focal_class.file: dubbo-common/src/main/java/com/alibaba/dubbo/common/io/StreamUtils.java
focal_class.identifier: StreamUtils
focal_class.class_method_signature: StreamUtils.StreamUtils()
focal_class.full_signature: private  StreamUtils()
focal_class.identifier: StreamUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  StreamUtils()
focal_class.class_method_signature: StreamUtils.limitedInputStream(final InputStream is, final int limit)
focal_class.full_signature: public static InputStream limitedInputStream(final InputStream is, final int limit)
focal_class.identifier: limitedInputStream
focal_class.modifiers: public static
focal_class.parameters: (final InputStream is, final int limit)
focal_class.return: InputStream
focal_class.signature: InputStream limitedInputStream(final InputStream is, final int limit)
focal_class.class_method_signature: StreamUtils.markSupportedInputStream(final InputStream is, final int markBufferSize)
focal_class.full_signature: public static InputStream markSupportedInputStream(final InputStream is, final int markBufferSize)
focal_class.identifier: markSupportedInputStream
focal_class.modifiers: public static
focal_class.parameters: (final InputStream is, final int markBufferSize)
focal_class.return: InputStream
focal_class.signature: InputStream markSupportedInputStream(final InputStream is, final int markBufferSize)
focal_class.class_method_signature: StreamUtils.markSupportedInputStream(final InputStream is)
focal_class.full_signature: public static InputStream markSupportedInputStream(final InputStream is)
focal_class.identifier: markSupportedInputStream
focal_class.modifiers: public static
focal_class.parameters: (final InputStream is)
focal_class.return: InputStream
focal_class.signature: InputStream markSupportedInputStream(final InputStream is)
focal_class.class_method_signature: StreamUtils.skipUnusedStream(InputStream is)
focal_class.full_signature: public static void skipUnusedStream(InputStream is)
focal_class.identifier: skipUnusedStream
focal_class.modifiers: public static
focal_class.parameters: (InputStream is)
focal_class.return: void
focal_class.signature: void skipUnusedStream(InputStream is)
focal_method.body: public static InputStream limitedInputStream(final InputStream is, final int limit) throws IOException {
          return new InputStream() {
              private int mPosition = 0, mMark = 0, mLimit = Math.min(limit, is.available());
  
              @Override
              public int read() throws IOException {
                  if (mPosition < mLimit) {
                      mPosition++;
                      return is.read();
                  }
                  return -1;
              }
  
              @Override
              public int read(byte b[], int off, int len) throws IOException {
                  if (b == null)
                      throw new NullPointerException();
  
                  if (off < 0 || len < 0 || len > b.length - off)
                      throw new IndexOutOfBoundsException();
  
                  if (mPosition >= mLimit)
                      return -1;
  
                  if (mPosition + len > mLimit)
                      len = mLimit - mPosition;
  
                  if (len <= 0)
                      return 0;
  
                  is.read(b, off, len);
                  mPosition += len;
                  return len;
              }
  
              @Override
              public long skip(long len) throws IOException {
                  if (mPosition + len > mLimit)
                      len = mLimit - mPosition;
  
                  if (len <= 0)
                      return 0;
  
                  is.skip(len);
                  mPosition += len;
                  return len;
              }
  
              @Override
              public int available() {
                  return mLimit - mPosition;
              }
  
              @Override
              public boolean markSupported() {
                  return is.markSupported();
              }
  
              @Override
              public void mark(int readlimit) {
                  is.mark(readlimit);
                  mMark = mPosition;
              }
  
              @Override
              public void reset() throws IOException {
                  is.reset();
                  mPosition = mMark;
              }
  
              @Override
              public void close() throws IOException {
              }
          };
      }
focal_method.class_method_signature: StreamUtils.limitedInputStream(final InputStream is, final int limit)
focal_method.full_signature: public static InputStream limitedInputStream(final InputStream is, final int limit)
focal_method.identifier: limitedInputStream
focal_method.invocations: min available read read skip markSupported mark reset
focal_method.modifiers: public static
focal_method.parameters: (final InputStream is, final int limit)
focal_method.return: InputStream
focal_method.signature: InputStream limitedInputStream(final InputStream is, final int limit)