Skip to content

Commit e856d57

Browse files
authored
Publish Segment.size and Segment.remainingCapacity (#409)
Fixes #408
1 parent fa3afc3 commit e856d57

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

core/api/kotlinx-io-core.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ public final class kotlinx/io/Segment {
111111
public final synthetic fun getNext ()Lkotlinx/io/Segment;
112112
public final synthetic fun getPos ()I
113113
public final synthetic fun getPrev ()Lkotlinx/io/Segment;
114-
public final synthetic fun getRemainingCapacity ()I
115-
public final synthetic fun getSize ()I
114+
public final fun getRemainingCapacity ()I
115+
public final fun getSize ()I
116116
public final synthetic fun setLimit (I)V
117117
public final synthetic fun setNext (Lkotlinx/io/Segment;)V
118118
public final synthetic fun setPos (I)V

core/common/src/Segment.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,20 @@ public class Segment {
345345
limit += srcEndOffset - srcStartOffset
346346
}
347347

348-
@PublishedApi
349-
@get:JvmSynthetic
350-
internal val size: Int
348+
/**
349+
* The number of readable bytes contained in this segment.
350+
*
351+
* @sample kotlinx.io.samples.unsafe.UnsafeBufferOperationsSamples.readUleb128
352+
*/
353+
public val size: Int
351354
get() = limit - pos
352355

353-
@PublishedApi
354-
@get:JvmSynthetic
355-
internal val remainingCapacity: Int
356+
/**
357+
* The number of bytes that could be written into this segment.
358+
*
359+
* @sample kotlinx.io.samples.unsafe.UnsafeBufferOperationsSamples.writeUleb128Array
360+
*/
361+
public val remainingCapacity: Int
356362
get() = data.size - limit
357363

358364
/**

0 commit comments

Comments
 (0)