test_class.declarator: BOUNDARY = "someboundary"
test_class.modifier: public static final
test_class.original_string: public static final String BOUNDARY = "someboundary";
test_class.type: String
test_class.var_name: BOUNDARY
test_class.declarator: CONTENT_TYPE = "application/pdf"
test_class.modifier: public static final
test_class.original_string: public static final String CONTENT_TYPE = "application/pdf";
test_class.type: String
test_class.var_name: CONTENT_TYPE
test_class.declarator: TOTAL_LENGTH = 0
test_class.modifier: public static final
test_class.original_string: public static final int TOTAL_LENGTH = 0;
test_class.type: int
test_class.var_name: TOTAL_LENGTH
test_class.declarator: NEW_LINE = "\r\n"
test_class.modifier: public static final
test_class.original_string: public static final String NEW_LINE = "\r\n";
test_class.type: String
test_class.var_name: NEW_LINE
test_class.declarator: inputStream
test_class.modifier: private
test_class.original_string: private ByteArrayInputStream inputStream;
test_class.type: ByteArrayInputStream
test_class.var_name: inputStream
test_class.declarator: outputStream
test_class.modifier: private
test_class.original_string: private ByteArrayOutputStream outputStream;
test_class.type: ByteArrayOutputStream
test_class.var_name: outputStream
test_class.declarator: inputBytes
test_class.modifier: private
test_class.original_string: private byte[] inputBytes;
test_class.type: byte[]
test_class.var_name: inputBytes
test_class.declarator: rangeHelper = new RangeHelper()
test_class.modifier: private final
test_class.original_string: private final RangeHelper rangeHelper = new RangeHelper();
test_class.type: RangeHelper
test_class.var_name: rangeHelper
test_class.declarator: rangePartHeaderSerializer = new RangePartHeaderSerializer()
test_class.modifier: private final
test_class.original_string: private final RangePartHeaderSerializer rangePartHeaderSerializer = new RangePartHeaderSerializer();
test_class.type: RangePartHeaderSerializer
test_class.var_name: rangePartHeaderSerializer
test_class.declarator: streamHelper = new StreamHelper(rangeHelper, rangePartHeaderSerializer)
test_class.modifier: private final
test_class.original_string: private final StreamHelper streamHelper = new StreamHelper(rangeHelper, rangePartHeaderSerializer);
test_class.type: StreamHelper
test_class.var_name: streamHelper
test_class.declarator: sliceHelper = new SliceHelper()
test_class.modifier: private final
test_class.original_string: private final SliceHelper sliceHelper = new SliceHelper();
test_class.type: SliceHelper
test_class.var_name: sliceHelper
test_class.file: http/src/test/java/ro/polak/http/servlet/helper/StreamHelperTest.java
test_class.identifier: StreamHelperTest
test_case.body: @Test
      public void shouldServeTheSameBytesForMultipleRangeGreaterThanTheBuffer() throws IOException {
          List<Range> ranges = new ArrayList<>();
          ranges.add(new Range(0, 550));
          ranges.add(new Range(1024, 1623));
  
          byte[] inputBytesSliced = sliceHelper.getSliceForRanges(inputBytes, ranges);
  
  
          streamHelper.serveMultiRangeStream(inputStream, outputStream, ranges, BOUNDARY, CONTENT_TYPE, TOTAL_LENGTH);
  
          byte[] out = outputStream.toByteArray();
  
          assertThat(out.length, is(equalTo(inputBytesSliced.length)));
          assertThat(out, equalTo(inputBytesSliced));
      }
test_case.class_method_signature: StreamHelperTest.shouldServeTheSameBytesForMultipleRangeGreaterThanTheBuffer()
test_case.full_signature: @Test public void shouldServeTheSameBytesForMultipleRangeGreaterThanTheBuffer()
test_case.identifier: shouldServeTheSameBytesForMultipleRangeGreaterThanTheBuffer
test_case.invocations: add add getSliceForRanges serveMultiRangeStream toByteArray assertThat is equalTo assertThat equalTo
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldServeTheSameBytesForMultipleRangeGreaterThanTheBuffer()
focal_class.declarator: BUFFER_SIZE = 512
focal_class.modifier: private static final
focal_class.original_string: private static final int BUFFER_SIZE = 512;
focal_class.type: int
focal_class.var_name: BUFFER_SIZE
focal_class.declarator: NEW_LINE = "\r\n"
focal_class.modifier: private static final
focal_class.original_string: private static final String NEW_LINE = "\r\n";
focal_class.type: String
focal_class.var_name: NEW_LINE
focal_class.declarator: rangeHelper
focal_class.modifier: private final
focal_class.original_string: private final RangeHelper rangeHelper;
focal_class.type: RangeHelper
focal_class.var_name: rangeHelper
focal_class.declarator: rangePartHeaderSerializer
focal_class.modifier: private final
focal_class.original_string: private final RangePartHeaderSerializer rangePartHeaderSerializer;
focal_class.type: RangePartHeaderSerializer
focal_class.var_name: rangePartHeaderSerializer
focal_class.file: http/src/main/java/ro/polak/http/servlet/helper/StreamHelper.java
focal_class.identifier: StreamHelper
focal_class.class_method_signature: StreamHelper.StreamHelper(final RangeHelper rangeHelper,
                          final RangePartHeaderSerializer rangePartHeaderSerializer)
focal_class.full_signature: public  StreamHelper(final RangeHelper rangeHelper,
                          final RangePartHeaderSerializer rangePartHeaderSerializer)
focal_class.identifier: StreamHelper
focal_class.modifiers: public
focal_class.parameters: (final RangeHelper rangeHelper,
                          final RangePartHeaderSerializer rangePartHeaderSerializer)
focal_class.signature:  StreamHelper(final RangeHelper rangeHelper,
                          final RangePartHeaderSerializer rangePartHeaderSerializer)
focal_class.class_method_signature: StreamHelper.serveMultiRangeStream(final InputStream inputStream, final OutputStream outputStream)
focal_class.full_signature: public void serveMultiRangeStream(final InputStream inputStream, final OutputStream outputStream)
focal_class.identifier: serveMultiRangeStream
focal_class.modifiers: public
focal_class.parameters: (final InputStream inputStream, final OutputStream outputStream)
focal_class.return: void
focal_class.signature: void serveMultiRangeStream(final InputStream inputStream, final OutputStream outputStream)
focal_class.class_method_signature: StreamHelper.doServeRangeStream(final InputStream inputStream, final OutputStream outputStream, final Range range)
focal_class.full_signature: private void doServeRangeStream(final InputStream inputStream, final OutputStream outputStream, final Range range)
focal_class.identifier: doServeRangeStream
focal_class.modifiers: private
focal_class.parameters: (final InputStream inputStream, final OutputStream outputStream, final Range range)
focal_class.return: void
focal_class.signature: void doServeRangeStream(final InputStream inputStream, final OutputStream outputStream, final Range range)
focal_class.class_method_signature: StreamHelper.serveMultiRangeStream(final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final List<Range> rangeList,
                                        final String boundary,
                                        final String contentType,
                                        final long totalLength)
focal_class.full_signature: public void serveMultiRangeStream(final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final List<Range> rangeList,
                                        final String boundary,
                                        final String contentType,
                                        final long totalLength)
focal_class.identifier: serveMultiRangeStream
focal_class.modifiers: public
focal_class.parameters: (final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final List<Range> rangeList,
                                        final String boundary,
                                        final String contentType,
                                        final long totalLength)
focal_class.return: void
focal_class.signature: void serveMultiRangeStream(final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final List<Range> rangeList,
                                        final String boundary,
                                        final String contentType,
                                        final long totalLength)
focal_class.class_method_signature: StreamHelper.doServeRangePartHeader(final OutputStream outputStream,
                                          final String boundary,
                                          final String contentType,
                                          final long totalLength,
                                          final Range range)
focal_class.full_signature: private void doServeRangePartHeader(final OutputStream outputStream,
                                          final String boundary,
                                          final String contentType,
                                          final long totalLength,
                                          final Range range)
focal_class.identifier: doServeRangePartHeader
focal_class.modifiers: private
focal_class.parameters: (final OutputStream outputStream,
                                          final String boundary,
                                          final String contentType,
                                          final long totalLength,
                                          final Range range)
focal_class.return: void
focal_class.signature: void doServeRangePartHeader(final OutputStream outputStream,
                                          final String boundary,
                                          final String contentType,
                                          final long totalLength,
                                          final Range range)
focal_class.class_method_signature: StreamHelper.serveMultiRangeStream(final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final Range range)
focal_class.full_signature: public void serveMultiRangeStream(final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final Range range)
focal_class.identifier: serveMultiRangeStream
focal_class.modifiers: public
focal_class.parameters: (final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final Range range)
focal_class.return: void
focal_class.signature: void serveMultiRangeStream(final InputStream inputStream,
                                        final OutputStream outputStream,
                                        final Range range)
focal_method.body: public void serveMultiRangeStream(final InputStream inputStream, final OutputStream outputStream)
              throws IOException {
          int numberOfBufferReadBytes;
          byte[] buffer = new byte[BUFFER_SIZE];
  
          while ((numberOfBufferReadBytes = inputStream.read(buffer)) != -1) {
              outputStream.write(buffer, 0, numberOfBufferReadBytes);
              outputStream.flush();
  
              Statistics.addBytesSent(numberOfBufferReadBytes);
          }
      }
focal_method.class_method_signature: StreamHelper.serveMultiRangeStream(final InputStream inputStream, final OutputStream outputStream)
focal_method.full_signature: public void serveMultiRangeStream(final InputStream inputStream, final OutputStream outputStream)
focal_method.identifier: serveMultiRangeStream
focal_method.invocations: read write flush addBytesSent
focal_method.modifiers: public
focal_method.parameters: (final InputStream inputStream, final OutputStream outputStream)
focal_method.return: void
focal_method.signature: void serveMultiRangeStream(final InputStream inputStream, final OutputStream outputStream)