upickle.core
Members list
Packages
Type members
Classlikes
Throw this inside a Visitor's handler functions to fail the processing of JSON. The Facade just needs to provide the error message, and it is up to the driver to ensure it is properly wrapped in a AbortException with the relevant source information.
Throw this inside a Visitor's handler functions to fail the processing of JSON. The Facade just needs to provide the error message, and it is up to the driver to ensure it is properly wrapped in a AbortException with the relevant source information.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Signals failure processsing JSON after parsing.
Signals failure processsing JSON after parsing.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Visits the elements of a json array.
Visits the elements of a json array.
Attributes
- Supertypes
- Known subtypes
-
A reified version of Visitor, allowing visitor method calls to be buffered up, stored somewhere, and replayed later.
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrortrait Transformer[BufferedValue]class Objecttrait Matchableclass AnyShow all
- Self type
-
BufferedValue.type
Models a growable buffer of Bytes, which are Chars or Bytes. We maintain an Array[Byte] as a buffer, and read Bytes into it using readDataIntoBuffer and drop old Bytes using dropBufferUntil.
Models a growable buffer of Bytes, which are Chars or Bytes. We maintain an Array[Byte] as a buffer, and read Bytes into it using readDataIntoBuffer and drop old Bytes using dropBufferUntil.
In general, BufferingByteParser allows us to keep the fast path fast:
- Reading byte-by-byte from the buffer is a bounds check and direct Array access, without any indirection or polymorphism.
- We load Bytes 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 Bytes; instead, we wait until we need to call growBuffer, and use that as a chance to copy the remaining un-dropped Bytes to either the start of the current buffer or the start of a newly-allocated bigger buffer (if necessary)
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
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.
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 char-by-char 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)
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Defines common functionality to any parser that works on a java.io.InputStream
Defines common functionality to any parser that works on a java.io.InputStream
Allows you to look up individual bytes by index, take slices of byte ranges or strings, and drop old portions of buffered data once you are certain you no longer need them.
The buffer
size is managed by allowing it to grow in size until it exceeds its capacity. When that happens, one of two things happen:
-
If the buffer has enough space, we left-shift the data in the buffer to over-write the portion that has already been dropped.
-
If the buffer does not have enough space, we allocate a new buffer big enough to hold the new data we need to store (size a power of two multiple of the old size) and copy the data over, again shifted left .
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class ByteBuilder
A fast buffer that can be used to store Bytes (Bytes or Chars).
A fast buffer that can be used to store Bytes (Bytes or Chars).
Generally faster than the equivalent StringBuilder or java.io.ByteArrayOutputStream, since:
- It is specialized and without the overhead of polymorphism or synchronization.
- It allows the user to call
ensureLength
andappendUnsafe
separately, e.g. callignensureLength
once beforeappendUnsafe
-ing multiple Bytes - It provides fast methods like makeString or writeOutToIfLongerThan, that let you push the data elsewhere with minimal unnecessary copying
Attributes
- Supertypes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ByteUtils.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class CharBuilder
A fast buffer that can be used to store Chars (Bytes or Chars).
A fast buffer that can be used to store Chars (Bytes or Chars).
Generally faster than the equivalent StringBuilder or java.io.ByteArrayOutputStream, since:
- It is specialized and without the overhead of polymorphism or synchronization.
- It allows the user to call
ensureLength
andappendUnsafe
separately, e.g. callignensureLength
once beforeappendUnsafe
-ing multiple Chars - It provides fast methods like makeString or writeOutToIfLongerThan, that let you push the data elsewhere with minimal unnecessary copying
Attributes
- Supertypes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CharUtils.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Implicit to indicate that we are currently deriving an implicit T. Used to avoid the implicit being derived from picking up its own definition, resulting in infinite looping/recursion
Implicit to indicate that we are currently deriving an implicit T. Used to avoid the implicit being derived from picking up its own definition, resulting in infinite looping/recursion
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
mutable.Map[K, V] implementation wrapping a java.util.LinkedHashMap[K, V] which doesn't allow null as key. Useful since the java.util implementation is safe from hash-collision attacks.
mutable.Map[K, V] implementation wrapping a java.util.LinkedHashMap[K, V] which doesn't allow null as key. Useful since the java.util implementation is safe from hash-collision attacks.
Attributes
- Companion
- object
- Supertypes
-
trait Map[K, V]trait MapOps[K, V, Map, Map[K, V]]trait Shrinkable[K]trait Builder[(K, V), Map[K, V]]trait Growable[(K, V)]trait Clearabletrait Cloneable[Map[K, V]]trait Cloneabletrait Map[K, V]trait Equalstrait MapFactoryDefaults[K, V, Map, Iterable]trait MapOps[K, V, Map, Map[K, V]]trait PartialFunction[K, V]trait K => Vtrait Iterable[(K, V)]trait Iterable[(K, V)]trait IterableFactoryDefaults[(K, V), Iterable]trait IterableOps[(K, V), Iterable, Map[K, V]]trait IterableOnceOps[(K, V), Iterable, Map[K, V]]trait IterableOnce[(K, V)]class Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LinkedHashMap.type
A visitor that wraps another but prints out what methods get called, useful for debugging
A visitor that wraps another but prints out what methods get called, useful for debugging
Attributes
- Supertypes
NullFacade discards all JSON AST information.
NullFacade discards all JSON AST information.
This is the simplest possible facade. It could be useful for checking JSON for correctness (via parsing) without worrying about saving the data.
It will always return () on any successful parse, no matter the content.
Attributes
- Supertypes
- Self type
-
NoOpVisitor.type
Base class for visiting elements of json arrays and objects.
Base class for visiting elements of json arrays and objects.
Type parameters
- J
-
the result of visiting elements (e.g. a json AST or side-effecting writer)
- T
-
???
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
Visits the elements of a json object.
Visits the elements of a json object.
Attributes
- Supertypes
- Known subtypes
-
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ParseUtils.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RenderUtils.type
A visitor that throws an error for all the visit methods which it does not define, letting you only define the handlers you care about.
A visitor that throws an error for all the visit methods which it does not define, letting you only define the handlers you care about.
Attributes
- Supertypes
- Known subtypes
-
object StringVisitortrait SimpleReader[T]trait TaggedReadWriter[T]class Leaf[T]class Node[T]trait TaggedReader[T]class Leaf[T]class Node[T]Show all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
StringVisitor.type
Adds a JSON Path to exceptions thrown by the delegate Visitor.
Adds a JSON Path to exceptions thrown by the delegate Visitor.
Useful for debugging failures. Adds ~10% overhead depending on the parser.
Attributes
- See also
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TraceVisitor.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object BufferedValuetrait Writer[T]trait ObjectWriter[T]trait ReadWriter[T]class Delegate[T]trait TaggedReadWriter[T]class Leaf[T]class Node[T]trait TaggedWriter[T]class Leaf[T]class Node[T]Show all
Basic functionality to be able to read and write objects. Kept as a trait so other internal files can use it, while also mixing it into the upickle
package to form the public API1
Basic functionality to be able to read and write objects. Kept as a trait so other internal files can use it, while also mixing it into the upickle
package to form the public API1
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Standard set of hooks uPickle uses to traverse over a structured data. A superset of the JSON, MessagePack, and Scala object hierarchies, since it needs to support efficiently processing all of them.
Standard set of hooks uPickle uses to traverse over a structured data. A superset of the JSON, MessagePack, and Scala object hierarchies, since it needs to support efficiently processing all of them.
Note that some parameters are un-set (-1) when not available; e.g. visitArray
's length
is not set when parsing JSON input (since it cannot be known up front) and the various index
parameters are not set when traversing Scala object hierarchies.
When expecting to deal with a subset of the methods; it is common to forward the ones you don't care about to the ones you do; e.g. JSON visitors would forward all visitFloat32
/visitInt
/etc. methods to visitFloat64
Type parameters
- J
-
the result of visiting elements (e.g. a json AST or side-effecting writer)
- T
-
???
Attributes
- See also
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object Builderobject NoOpVisitorobject StringVisitortrait SimpleReader[T]trait TaggedReadWriter[T]class Leaf[T]class Node[T]trait TaggedReader[T]class Leaf[T]class Node[T]trait Reader[T]trait ReadWriter[T]class Delegate[T]Show all
A CharSequence that wraps an array of byteents without any copying.
A CharSequence that wraps an array of byteents without any copying.
Note that the arr is mutable, and so the WrapByteArrayCharSeq should not itself be stored: either use it immediately when given it or call .toString
if you want to store the data for later use.
Attributes
- Supertypes
-
trait CharSequenceclass Objecttrait Matchableclass Any
A CharSequence that wraps an array of charents without any copying.
A CharSequence that wraps an array of charents without any copying.
Note that the arr is mutable, and so the WrapCharArrayCharSeq should not itself be stored: either use it immediately when given it or call .toString
if you want to store the data for later use.
Attributes
- Supertypes
-
trait CharSequenceclass Objecttrait Matchableclass Any