toString

open override fun toString(): String(source)

Returns a human-readable string that describes the contents of this buffer. For buffers containing few bytes, this is a string like Buffer(size=4 hex=0000ffff). However, if the buffer is too large, a string will contain its size and only a prefix of data, like Buffer(size=1024 hex=01234…). Thus, the string could not be used to compare buffers or verify buffer's content.

Samples

import kotlinx.io.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   val buffer = Buffer()
assertEquals("Buffer(size=0)", buffer.toString())

buffer.writeInt(0x12345678)
assertEquals("Buffer(size=4 hex=12345678)", buffer.toString())

buffer.skip(1)
assertEquals("Buffer(size=3 hex=345678)", buffer.toString()) 
   //sampleEnd
}