Skip to content

Commit e4b40f7

Browse files
committed
include errors
1 parent 58ab9fc commit e4b40f7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

source/data-formats/codecs.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,10 @@ types:
168168
The following code shows how to construct a ``CodecRegistry`` by using
169169
the ``fromCodecs()`` method:
170170

171-
.. literalinclude:: /includes/data-formats/codecs.kt
172-
:language: kotlin
173-
:start-after: start-fromcodecs
174-
:end-before: end-fromcodecs
175-
:dedent:
171+
.. code-block:: kotlin
172+
173+
val codecRegistry = CodecRegistries
174+
.fromCodecs(IntegerCodec(), PowerStatusCodec())
176175

177176
The preceding example assigns the ``CodecRegistry`` the following ``Codec``
178177
implementations:
@@ -184,11 +183,10 @@ implementations:
184183
You can retrieve the ``Codec`` instances from the ``CodecRegistry`` instance
185184
by using the following code:
186185

187-
.. literalinclude:: /includes/data-formats/codecs.kt
188-
:language: kotlin
189-
:start-after: start-retrieve-codecs
190-
:end-before: end-retrieve-codecs
191-
:dedent:
186+
.. code-block:: kotlin
187+
188+
val powerStatusCodec = codecRegistry.get(PowerStatus::class.java)
189+
val integerCodec = codecRegistry.get(Integer::class.java)
192190

193191
If you attempt to retrieve a ``Codec`` instance for a class that is not
194192
registered, the ``codecRegistry.get()`` method raises a

0 commit comments

Comments
 (0)