@@ -94,10 +94,10 @@ public abstract class EncoderDecoder<C: EncoderDecoder.Config>(config: C): Encod
9494 * replacement byte sequence being used, can emit more; its maximum emission size is
9595 * required to be calculated, such as `(replacementStrategy.size * 2).coerceAtLeast(4)`.
9696 *
97- * Value will be greater than `0` , or `-1` which indicates that the [EncoderDecoder.Config]
98- * implementation has not updated to the new constructor introduced in version `2.6.0` and
99- * as such is unable to be used with `:core` module APIs dependent on this value (such as
100- * [Decoder.decodeBuffered] or [Decoder.decodeBufferedAsync]).
97+ * Value will be between `1` and `255` (inclusive) , or `-1` which indicates that the
98+ * [EncoderDecoder.Config] implementation has not updated to the new constructor introduced
99+ * in version `2.6.0` and as such is unable to be used with `:core` module APIs dependent
100+ * on this value (such as [Decoder.decodeBuffered] or [Decoder.decodeBufferedAsync]).
101101 * */
102102 @JvmField
103103 public val maxDecodeEmit : Int ,
@@ -126,7 +126,7 @@ public abstract class EncoderDecoder<C: EncoderDecoder.Config>(config: C): Encod
126126 /* *
127127 * Instantiates a new [Config] instance.
128128 *
129- * @throws [IllegalArgumentException] If [maxDecodeEmit] is less than `1`.
129+ * @throws [IllegalArgumentException] If [maxDecodeEmit] is less than `1` or greater than `255` .
130130 * */
131131 protected constructor (
132132 isLenient: Boolean? ,
@@ -143,6 +143,7 @@ public abstract class EncoderDecoder<C: EncoderDecoder.Config>(config: C): Encod
143143 unused = null ,
144144 ) {
145145 require(maxDecodeEmit > 0 ) { " maxDecodeEmit must be greater than 0" }
146+ require(maxDecodeEmit < 256 ) { " maxDecodeEmit must be less than 256" }
146147 }
147148
148149 /* *
0 commit comments