Sorry, I guess the question doesn't make sense since I'm dealing with a
stream of paths rather than one. I can certainly create a composite source
as follows.

    def intervalLinesForPath(path: Path): Source[String, Future[Long]] = {

    val file = path.toFile

    val fileSource: Source[ByteString, Future[Long]] = FileIO.fromFile(file)
// chunksize parameter

    val asLines: Source[ByteString, Future[Long]] = fileSource.via(Framing
.delimiter(ByteString(System.lineSeparator), maximumFrameLength = 512,
allowTruncation = true))

    val asStrings: Source[String, Future[Long]] = asLines.map { bs =>
bs.utf8String
}

    asStrings

  }

On Mon, Feb 8, 2016 at 12:46 PM, Richard Rodseth <[email protected]> wrote:

> I'm trying to capture a file read in a reusable Flow as follows. But I'm
> scratching my head about how to capture the materialized value. As it
> stands the signature of result is Flow[Path, String, Unit] rather than
> Flow[Path, String, Future[Long]]. I've tried various combinations of viaMat
> and mapMaterializedValue but haven't been able to get the signatures right.
> What am I missing? Thanks in advance.
>
> def pathToIntervalLines: Flow[Path,String, Future[Long]] = {
>
>     val result  = Flow[Path].flatMapConcat { path =>
>
>       val file = path.toFile
>
>       val fileSource: Source[ByteString, Future[Long]] = FileIO.fromFile(
> file)
>
>       val asLines : Source[ByteString, Future[Long]] = fileSource.via(
> Framing.delimiter(ByteString(System.lineSeparator), maximumFrameLength =
> 512, allowTruncation = true))
>
>       val asStrings : Source[String, Future[Long]] = asLines.map { bs =>
> bs.utf8String }
>
>       asStrings
>
>     }
>
>     result
>
>   }
>
>
>

-- 
>>>>>>>>>>      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