Hi,

If I understand correctly I think this is your solution:
https://github.com/bluelabsio/s3-stream/blob/master/s3-stream/src/test/scala/com/bluelabs/s3stream/ChunkerSpec.scala

On Thursday, March 5, 2015 at 8:15:32 PM UTC+4, dan costelloe wrote:
>
> Hi all,
>
> Following some helpful advice on this forum, I've been using the Chunker 
> as defined on the Akka Streams cookbook page 
>
>
> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M4/scala/stream-cookbook.html
>
> To test it out, I create a ByteString Source and a re-chunked version:
>
> val bsSource = Source(List.fill(5)("0123456789") map (x => ByteString(x)))
> val chunkedSource = bsSource.transform(() => new Chunker(3))
>
> I'm debugging / dumping values via the REPL:
>
> val identityFlow: Flow[ByteString, ByteString] = Flow[ByteString].map(x => 
> x)
> identityFlow.runWith(chunkedSource, ForeachSink(println))
>
> Which produces:
> ByteString(48, 49, 50)
> ByteString(51, 52, 53)
> ByteString(54, 55, 56)
> ByteString(57)
> ByteString(48, 49, 50)
> ByteString(51, 52, 53)
> ByteString(54, 55, 56)
> ByteString(57)
> ByteString(48, 49, 50)
> ByteString(51, 52, 53)
> ByteString(54, 55, 56)
> ByteString(57)
> ByteString(48, 49, 50)
> ByteString(51, 52, 53)
> ByteString(54, 55, 56)
> ByteString(57)
> ByteString(48, 49, 50)
> ByteString(51, 52, 53)
> ByteString(54, 55, 56)
> ByteString(57)
>
> This makes sense: each incoming block of 10 is split into (3, 3, 3, 1).
>
> The question is: can the chunker be modified to produce a result like this 
> instead: ?
>
> ByteString(48, 49, 50)
> ByteString(51, 52, 53)
> ByteString(54, 55, 56)
> ByteString(57, 48, 49)
> ByteString(50, 51, 52)
> ByteString(53, 54, 55)
> ByteString(56, 57, 48)
> ByteString(49, 50, 51)
> ByteString(52, 53, 54)
> ByteString(55, 56, 57)
> ByteString(48, 49, 50)
> ByteString(51, 52, 53)
> ByteString(54, 55, 56)
> ByteString(57, 48, 49)
> ByteString(50, 51, 52)
> ByteString(53, 54, 55)
> ByteString(56, 57)
>
> If so, how?
>
> Advice welcome. Many thanks,
> dan
>
>
>
>
>
>
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to