Trait

upickle.core

BufferingCharParser

Related Doc: package core

Permalink

trait BufferingCharParser extends AnyRef

Models a growable buffer of Chars, which are Chars or Bytes. We maintain an Array[Char] as a buffer, and read Chars into it using readDataIntoBuffer and drop old Chars using dropBufferUntil.

In general, BufferingCharParser allows us to keep the fast path fast:

- Reading elem-by-elem from the buffer is a bounds check and direct Array access, without any indirection or polymorphism. - We load Chars in batches into the buffer, which allows us to take advantage of batching APIs like InputStream.read - We amortize the overhead of the indirect/polymorphic readDataIntoBuffer call over the size of each batch

Note that dropBufferUntil only advances a dropped index and does not actually zero out the dropped Chars; instead, we wait until we need to call growBuffer, and use that as a chance to copy the remaining un-dropped Chars to either the start of the current buffer or the start of a newly-allocated bigger buffer (if necessary)

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BufferingCharParser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def readDataIntoBuffer(buffer: Array[Char], bufferOffset: Int): (Array[Char], Boolean, Int)

    Permalink

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def appendCharsToBuilder(elems: CharBuilder, elemsStart: Int, elemsLength: Int): Unit

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def dropBufferUntil(i: Int): Unit

    Permalink
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def getBufferCopyCount(): Int

    Permalink
  12. def getBufferGrowCount(): Int

    Permalink
  13. def getBufferLength(): Int

    Permalink
  14. def getCharSafe(i: Int): Char

    Permalink
  15. def getCharUnsafe(i: Int): Char

    Permalink
  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def getLastIdx: Int

    Permalink
  18. def growBuffer(until: Int): Unit

    Permalink

    Copies the non-dropped Chars in the current buffer to the start of either the current buffer, or a newly-allocated larger buffer if necessary.

  19. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. def requestUntil(until: Int): Boolean

    Permalink

    Used to ensure that elements up to until are available to read; returns whether or not we have read off the end of the input.

    Used to ensure that elements up to until are available to read; returns whether or not we have read off the end of the input.

    In the fast path, when until is less than the lastIdx we have buffered, there is no work to do and we return false.

    In the slow path, when until is more than lastIdx, we then run growBuffer to grow the buffer if necessary, and then readDataIntoBuffer to populate it. readDataIntoBuffer returns a newDone value to indicate whether we have read off the end of the input or not.

    Note that for some subclasses, growBuffer may be a no-op when we already know we have reached the end of input.

    Attributes
    protected
  25. def sliceArr(i: Int, n: Int): (Array[Char], Int, Int)

    Permalink
  26. def sliceString(i: Int, k: Int): String

    Permalink
  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  29. def unsafeCharSeqForRange(start: Int, length: Int): WrapCharArrayCharSeq

    Permalink
  30. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped