Packages

object EntityDecoder

EntityDecoder is used to attempt to decode an EntityBody This companion object provides a way to create new EntityDecoders along with some commonly used instances which can be resolved implicitly.

Source
EntityDecoder.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EntityDecoder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply[F[_], T](implicit ev: EntityDecoder[F, T]): EntityDecoder[F, T]

    summon an implicit EntityDecoder

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def binFile[F[_]](path: Path)(implicit arg0: Files[F], arg1: Concurrent[F]): EntityDecoder[F, Path]
  7. implicit def binary[F[_]](implicit arg0: Concurrent[F]): EntityDecoder[F, Chunk[Byte]]
  8. implicit def byteArrayDecoder[F[_]](implicit arg0: Concurrent[F]): EntityDecoder[F, Array[Byte]]
  9. implicit def byteVector[F[_]](implicit arg0: Concurrent[F]): EntityDecoder[F, ByteVector]
  10. implicit def charArrayDecoder[F[_]](implicit arg0: Concurrent[F]): EntityDecoder[F, Array[Char]]
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  12. def collectBinary[F[_]](m: Media[F])(implicit arg0: Concurrent[F]): DecodeResult[F, Chunk[Byte]]

    Helper method which simply gathers the body into a single Chunk

  13. def decodeBy[F[_], T](r1: MediaRange, rs: MediaRange*)(f: (Media[F]) ⇒ DecodeResult[F, T])(implicit arg0: Applicative[F]): EntityDecoder[F, T]

    Create a new EntityDecoder

    Create a new EntityDecoder

    The new EntityDecoder will attempt to decode messages of type T only if the Message satisfies the provided MediaRange.

    Exceptions thrown by f are not caught. Care should be taken that recoverable errors are returned as a DecodeResult#failure, or that system errors are raised in F.

  14. def decodeText[F[_]](m: Media[F])(implicit F: Concurrent[F], defaultCharset: Charset = DefaultCharset): F[String]

    Decodes a message to a String

  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  17. def error[F[_], T](t: Throwable)(implicit F: Concurrent[F]): EntityDecoder[F, T]

    Provides a mechanism to fail decoding

  18. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. def mixedMultipartResource[F[_]](headerLimit: Int = 1024, maxSizeBeforeWrite: Int = 52428800, maxParts: Int = 50, failOnLimit: Boolean = false, chunkSize: Int = 8192)(implicit arg0: Concurrent[F], arg1: Files[F]): Resource[F, EntityDecoder[F, Multipart[F]]]

    Multipart decoder that streams all parts past a threshold (anything above maxSizeBeforeWrite) into a temporary file.

    Multipart decoder that streams all parts past a threshold (anything above maxSizeBeforeWrite) into a temporary file. The decoder is only valid inside the Resource scope; once the Resource is released, all the created files are deleted.

    Note that no files are deleted until the Resource is released. Thus, sharing and reusing the resulting EntityDecoder is not recommended, and can lead to disk space leaks.

    The intended way to use this is as follows:

    mixedMultipartResource[F]()
      .flatTap(request.decodeWith(_, strict = true))
      .use { multipart =>
        // Use the decoded entity
      }
    headerLimit

    the max size for the headers, in bytes. This is required as headers are strictly evaluated and parsed.

    maxSizeBeforeWrite

    the maximum size of a particular part before writing to a file is triggered

    maxParts

    the maximum number of parts this decoder accepts. NOTE: this also may mean that a body that doesn't conform perfectly to the spec (i.e isn't terminated properly) but has a lot of parts might be parsed correctly, despite the total body being malformed due to not conforming to the multipart spec. You can control this by failOnLimit, by setting it to true if you want to raise an error if sending too many parts to a particular endpoint

    failOnLimit

    Fail if maxParts is exceeded _during_ multipart parsing.

    chunkSize

    the size of chunks created when reading data from temporary files.

    returns

    A supervised multipart decoder.

  23. implicit def multipart[F[_]](implicit arg0: Concurrent[F]): EntityDecoder[F, Multipart[F]]
  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. implicit def semigroupKForEntityDecoder[F[_]](implicit arg0: Functor[F]): SemigroupK[[β$0$]EntityDecoder[F, β$0$]]
  28. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  29. implicit def text[F[_]](implicit F: Concurrent[F], defaultCharset: Charset = DefaultCharset): EntityDecoder[F, String]
  30. def textFile[F[_]](path: Path)(implicit arg0: Files[F], arg1: Concurrent[F]): EntityDecoder[F, Path]
  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. implicit def void[F[_]](implicit arg0: Concurrent[F]): EntityDecoder[F, Unit]

    An entity decoder that ignores the content and returns unit.

  33. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Deprecated Value Members

  1. def binFile[F[_]](file: File)(implicit arg0: Files[F], arg1: Concurrent[F]): EntityDecoder[F, File]
    Annotations
    @deprecated
    Deprecated

    (Since version 0.23.5) Use overload with fs2.io.file.Path

  2. def mixedMultipart[F[_]](headerLimit: Int = 1024, maxSizeBeforeWrite: Int = 52428800, maxParts: Int = 50, failOnLimit: Boolean = false)(implicit arg0: Concurrent[F], arg1: Files[F]): EntityDecoder[F, Multipart[F]]

    Multipart decoder that streams all parts past a threshold (anything above maxSizeBeforeWrite) into a temporary file.

    Multipart decoder that streams all parts past a threshold (anything above maxSizeBeforeWrite) into a temporary file.

    Note: (BIG NOTE) Using this decoder for multipart decoding is good for the sake of not holding all information in memory, as it will never have more than maxSizeBeforeWrite in memory before writing to a temporary file. On top of this, you can gate the # of parts to further stop the quantity of parts you can have. That said, because after a threshold it writes into a temporary file, given bincompat reasons on 0.18.x, there is no way to make a distinction about which Part[F] is a stream reference to a file or not. Thus, consumers using this decoder should drain all Part[F] bodies if they were decoded correctly. That said, this decoder gives you more control about how many part bodies it parses in the first place, thus you can have more fine-grained control about how many parts you accept.

    headerLimit

    the max size for the headers, in bytes. This is required as headers are strictly evaluated and parsed.

    maxSizeBeforeWrite

    the maximum size of a particular part before writing to a file is triggered

    maxParts

    the maximum number of parts this decoder accepts. NOTE: this also may mean that a body that doesn't conform perfectly to the spec (i.e isn't terminated properly) but has a lot of parts might be parsed correctly, despite the total body being malformed due to not conforming to the multipart spec. You can control this by failOnLimit, by setting it to true if you want to raise an error if sending too many parts to a particular endpoint

    failOnLimit

    Fail if maxParts is exceeded _during_ multipart parsing.

    returns

    A multipart/form-data encoded vector of parts with some part bodies held in temporary files.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.23) Use mixedMultipartResource

  3. def textFile[F[_]](file: File)(implicit arg0: Files[F], arg1: Concurrent[F]): EntityDecoder[F, File]
    Annotations
    @deprecated
    Deprecated

    (Since version 0.23.5) Use overload with fs2.io.file.Path

Inherited from AnyRef

Inherited from Any

Ungrouped