# Custom EntityStreamingSupport

**URL:** <https://discuss.akka.io/t/custom-entitystreamingsupport/6612>\
**Category:** Akka HTTP\
**Tags:** akka-http, scala, streams\
**Created:** [May 28, 2020, 7:07am UTC](https://discuss.akka.io/t/custom-entitystreamingsupport/6612 "2020-05-28T07:07:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iltotore](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/iltotore/32/1945_2.png) [@Iltotore](https://discuss.akka.io/u/Iltotore)\
**Post date:** [May 28, 2020, 7:07am UTC](https://discuss.akka.io/t/custom-entitystreamingsupport/6612/1 "2020-05-28T07:07:27Z")

</div>

Hello,  
I’m trying to create a new implementation of EntityStreamingSupport.

Here is my actual code:

```scala
class ChecksumStreamingSupport private[akka](
                                              maxObjectSize: Int,
                                              val supported: ContentTypeRange,
                                              val contentType: ContentType,
                                              val framingRenderer: Flow[ByteString, ByteString, NotUsed],
                                              val parallelism: Int,
                                              val unordered: Boolean
                                            ) extends EntityStreamingSupport {

  def this(maxObjectSize: Int) =
    this(
      maxObjectSize,
      ContentTypeRange(ContentTypes.`application/octet-stream`),
      ContentTypes.`application/octet-stream`,
      Flow[ByteString].intersperse(ByteString("["), ByteString(","), ByteString("]")),
      1, false)

  override def framingDecoder: Flow[ByteString, ByteString, NotUsed] = ???

  override def withSupported(range: jm.ContentTypeRange): EntityStreamingSupport = new ChecksumStreamingSupport(maxObjectSize, range, contentType, framingRenderer, parallelism, unordered)

  override def withContentType(contentType: jm.ContentType): EntityStreamingSupport = new ChecksumStreamingSupport(maxObjectSize, supported, contentType, framingRenderer, parallelism, unordered)

  override def withParallelMarshalling(parallelism: Int, unordered: Boolean): EntityStreamingSupport = ???
}

```

The problem is I can’t use the #asScala method. To translate Java components to Scala because the ` import akka.http.impl.util.JavaMapping` class is unaccessible. (The prodived code is based on the ScalaDSL’s JsonStreamingEntitySupport)

So I’m asking for a workaround or link to the unfound documentation part.

Have a good day !

Edit: this new implementation is to serialize a checkum so a binary format.

---

<div class="post-metadata">

**Author:** ![jrudolph](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/jrudolph/32/80_2.png) [@jrudolph](https://discuss.akka.io/u/jrudolph)\
**Post date:** [June 22, 2020, 1:31pm UTC](https://discuss.akka.io/t/custom-entitystreamingsupport/6612/2 "2020-06-22T13:31:43Z")

</div>

Hi @Iltotore,

I see, that’s unfortunate indeed. In most cases, you can just try casting from the `javadsl` version to the `scaladsl` version since the Scala version usually extends the Java side. I guess it would be nice if we would provide `toScala` methods directly on the Java side. I created [https://github.com/akka/akka-http/issues/3270](https://github.com/akka/akka-http/issues/3270) to track that idea.

Johannes
