mirror of
https://github.com/corda/corda.git
synced 2025-03-16 00:55:24 +00:00
Align ByteArrays.kt file with O/S to reduce merge conflicts (#1472)
This commit is contained in:
parent
4b9dd514c2
commit
09c1e6c079
@ -33,7 +33,7 @@ sealed class ByteSequence(private val _bytes: ByteArray, val offset: Int, val si
|
||||
fun open() = ByteArrayInputStream(_bytes, offset, size)
|
||||
|
||||
/**
|
||||
* Create a sub-sequence of this sequence. A copy of the underlying array may be made, if a subclass overrides
|
||||
* Create a sub-sequence of this sequence. A copy of the underlying array may be made, if a subclass overrides
|
||||
* [bytes] to do so, as [OpaqueBytes] does.
|
||||
*
|
||||
* @param offset The offset within this sequence to start the new sequence. Note: not the offset within the backing array.
|
||||
@ -41,10 +41,7 @@ sealed class ByteSequence(private val _bytes: ByteArray, val offset: Int, val si
|
||||
*/
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
fun subSequence(offset: Int, size: Int): ByteSequence {
|
||||
require(offset >= 0)
|
||||
require(offset + size <= this.size)
|
||||
// Intentionally use bytes rather than _bytes, in case a subclass wants to prevent access to the original
|
||||
// underlying array which could be revealed here (e.g. OpaqueBytes).
|
||||
// Intentionally use bytes rather than _bytes, to mirror the copy-or-not behaviour of that property.
|
||||
return if (offset == 0 && size == this.size) this else of(bytes, this.offset + offset, size)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user