@Test public void testAppend() throws Exception { ChannelBuffer content = ChannelBuffers.copiedBuffer(CHUNKED_STRING, Charsets.UTF_8); StreamingHttpRequest request = stream.append(new DefaultHttpChunk(content)); assertEquals(request.awsChunks.size(), 8); }
public StreamingHttpRequest append(HttpChunk httpChunk) { if (currentRequest.append(httpChunk)) { HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1); Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete)); List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE); List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE); StreamingHttpRequest result = currentRequest; result.awsChunks = completeAwsChunks; currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks); return result; } else { return null; } }
AwsChunkStream { public StreamingHttpRequest append(HttpChunk httpChunk) { if (currentRequest.append(httpChunk)) { HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1); Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete)); List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE); List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE); StreamingHttpRequest result = currentRequest; result.awsChunks = completeAwsChunks; currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks); return result; } else { return null; } } }
AwsChunkStream { public StreamingHttpRequest append(HttpChunk httpChunk) { if (currentRequest.append(httpChunk)) { HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1); Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete)); List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE); List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE); StreamingHttpRequest result = currentRequest; result.awsChunks = completeAwsChunks; currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks); return result; } else { return null; } }  }
AwsChunkStream { public StreamingHttpRequest append(HttpChunk httpChunk) { if (currentRequest.append(httpChunk)) { HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1); Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete)); List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE); List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE); StreamingHttpRequest result = currentRequest; result.awsChunks = completeAwsChunks; currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks); return result; } else { return null; } }  StreamingHttpRequest append(HttpChunk httpChunk); StreamingHttpRequest append(MappingHttpRequest initialRequest); }
AwsChunkStream { public StreamingHttpRequest append(HttpChunk httpChunk) { if (currentRequest.append(httpChunk)) { HttpChunk incompleteHttpChunk = currentRequest.httpChunks.remove(currentRequest.httpChunks.size() - 1); Map<Boolean, List<AwsChunk>> awsChunkPartition = currentRequest.awsChunks.stream().collect(partitioningBy(AwsChunk::isComplete)); List<AwsChunk> completeAwsChunks = awsChunkPartition.get(Boolean.TRUE); List<AwsChunk> incompleteAwsChunks = awsChunkPartition.get(Boolean.FALSE); StreamingHttpRequest result = currentRequest; result.awsChunks = completeAwsChunks; currentRequest = new StreamingHttpRequest(incompleteHttpChunk, incompleteAwsChunks); return result; } else { return null; } }  StreamingHttpRequest append(HttpChunk httpChunk); StreamingHttpRequest append(MappingHttpRequest initialRequest);  }