Packages

  • package root
    Definition Classes
    root
  • package io
    Definition Classes
    root
  • package dylemma
    Definition Classes
    io
  • package spac

    SPaC (short for "Streaming Parser Combinators") is a library for building stream consumers in a declarative style, specialized for tree-like data types like XML and JSON.

    SPaC (short for "Streaming Parser Combinators") is a library for building stream consumers in a declarative style, specialized for tree-like data types like XML and JSON.

    Many utilities for handling XML and JSON data involve parsing the entire "document" to some DOM model, then inspecting and transforming that model to extract information. The downside to these utilities is that when the document is very large, the DOM may not fit in memory. The workaround for this type of problem is to treat the document as a stream of "events", e.g. "StartElement" and "EndElement" for XML, or "StartObject" and "EndObject" for JSON. The downside to this workaround is that writing code to handle these streams can be complicated and error-prone, especially when the DOM is complicated.

    SPaC's goal is to drastically simplify the process of creating code to handle these streams.

    This package contains the "core" SPaC traits; Parser, Transformer, Splitter, and ContextMatcher.

    See the xml and json subpackages (provided by the xml-spac and json-spac libraries respectively) for specific utilities related to handling XML and JSON event streams.

    Definition Classes
    dylemma
  • package interop
    Definition Classes
    spac
  • package fs2

    Provides implicits to allow for interop between the core SPaC classes and fs2 / cats-effect.

    Provides implicits to allow for interop between the core SPaC classes and fs2 / cats-effect.

    - Parser gets toPipe and parseF - Transformer gets toPipe - Source gets toResource and toStream

    Definition Classes
    interop
  • ParserFs2Ops
  • SourceFs2Ops
  • TransformerFs2Ops

implicit final class SourceFs2Ops[A] extends AnyVal

Since Source is a synchronous-only encoding of the Resource pattern, it can be converted to a cats.effect.Resource by suspending its open and close operations in a Sync effect type F, yielding an Iterator[A] as its value.

This can be taken a step further by lifting that Resource to a fs2.Stream and wrapping the provided Iterator as a stream, to treat the whole Source[A] as a fs2.Stream[F, A]

Source
package.scala
Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SourceFs2Ops
  2. AnyVal
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SourceFs2Ops(source: Source[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toany2stringadd[SourceFs2Ops[A]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (SourceFs2Ops[A], B)
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toArrowAssoc[SourceFs2Ops[A]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def ensuring(cond: (SourceFs2Ops[A]) => Boolean, msg: => Any): SourceFs2Ops[A]
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  8. def ensuring(cond: (SourceFs2Ops[A]) => Boolean): SourceFs2Ops[A]
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: Boolean, msg: => Any): SourceFs2Ops[A]
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean): SourceFs2Ops[A]
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toEnsuring[SourceFs2Ops[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toStringFormat[SourceFs2Ops[A]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  12. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def toResource[F[_]](implicit arg0: Sync[F]): Resource[F, Iterator[A]]

    Upgrades this Source to a cats-effect Resource of the given effect type F.

    Upgrades this Source to a cats-effect Resource of the given effect type F. The open and close operations of the underlying source are assumed to be blocking, so they are wrapped with Sync[F].blocking { ... }.

    F

    The effect type

    returns

    A new Resource which delegates to this Source's open method

  15. def toStream[F[_]](chunkSize: Int = 32)(implicit F: Sync[F], FM: MonadCancel[F, _]): Stream[F, A]

    Converts this Source to an fs2 Stream in the given effect type F.

    Converts this Source to an fs2 Stream in the given effect type F.

    Uses toResource to encapsulate the underlying open/close operation, and uses Stream.fromBlockingIterator to wrap the underlying Iterator provided by the Source. The underlying Iterator is assumed to use blocking operations internally since typically the Iterator would be backed by something like a java.io.InputStream.

    F

    The effect type

    chunkSize

    The number of times the underlying Iterator's next should be called, per blocking step

    F

    Sync[F] typeclass instance

    FM

    MonadCancel[F, _] typeclass instance

    returns

    A Stream over the data provided by the underlying Source

  16. def toString(): String
    Definition Classes
    Any

Deprecated Value Members

  1. def [B](y: B): (SourceFs2Ops[A], B)
    Implicit
    This member is added by an implicit conversion from SourceFs2Ops[A] toArrowAssoc[SourceFs2Ops[A]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from AnyVal

Inherited from Any

Inherited by implicit conversion any2stringadd fromSourceFs2Ops[A] to any2stringadd[SourceFs2Ops[A]]

Inherited by implicit conversion StringFormat fromSourceFs2Ops[A] to StringFormat[SourceFs2Ops[A]]

Inherited by implicit conversion Ensuring fromSourceFs2Ops[A] to Ensuring[SourceFs2Ops[A]]

Inherited by implicit conversion ArrowAssoc fromSourceFs2Ops[A] to ArrowAssoc[SourceFs2Ops[A]]

Ungrouped