Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ public sealed class Encoder<C: EncoderDecoder.Config>(config: C): Decoder<C>(con
val sb = StringBuilder(maxSize)
encoder.encode(this, sb::append)
val result = sb.toString()
if (encoder.config.backFillBuffers) sb.wipe()
if (encoder.config.backFillBuffers) {
sb.wipe()
}
result
}
}
Expand All @@ -250,7 +252,7 @@ public sealed class Encoder<C: EncoderDecoder.Config>(config: C): Decoder<C>(con
if (i == maxSize) return@block a
val copy = a.copyOf(i)
if (encoder.config.backFillBuffers) {
a.fill(' ', 0, i)
a.fill('\u0000', 0, i)
}
copy
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public abstract class EncoderDecoder<C: EncoderDecoder.Config>(config: C): Encod
* data (e.g. a [StringBuilder], [CharArray], or [ByteArray]). Depending on the underlying
* encoding/decoding operation, such as an array over-allocation due to [encodeOutMaxSize]
* or [decodeOutMaxSize], those initially allocated buffers may not be returned as the
* function's result. Prior versions of this library always back-filled them with `0` or a
* space character, but that can be computationally expensive for large datasets and
* function's result. Prior versions of this library always back-filled them with `0` or the
* null character `\u0000`, but that can be computationally expensive for large datasets and
* potentially unnecessary if data is known to not be sensitive in nature.
*
* If `true`, any non-result buffer allocations are back-filled before being de-referenced
Expand Down