index of namespace default
 
 index of project core
 
 index of module core

Class core.Buffer


SynopsisAn array of bytes.

  Base classes:
  Methods:

Method base64Decode
Base64-decode String to buffer. Set io_offset to decoded size.
Signature
base64Decode():String in:int
Returns
String in:intNumber of decoded chars (excluding ASCIIZ)

 
 top of page
Method base64Encode
Base64-encode buffer region 0..io_offset and write to out String.
Signature
base64Encode():String out:int
Returns
String out:intNumber of encoded chars (excluding ASCIIZ)

 
 top of page
Method compareBuffer
Compare buffer to other buffer (io_offset bytes).
Signature
compareBuffer():Buffer o:boolean
Returns
Buffer o:booleantrue when bytes match, false otherwise

 
 top of page
Method fillI8
Fill the entire buffer with byte 'c'.
Signature
fillI8()

 
 top of page
Method fillZero
Fill the entire buffer with 0.
Signature
fillZero()

 
 top of page
Method free
Free buffer bytes
Signature
free()

 
 top of page
Method getChecksum
Return checksum for this Buffer.
Signature
getChecksum():int
Returns
int32bit buffer checksum

 
 top of page
Method getString
Extract 0 terminated string from buffer.
Signature
getString(intoff,
  intmax 
  )  
 :String
Arguments
intoffBuffer offset
intmaxMaximum number of characters to extract
Returns
Stringnew String instance holding the extracted string
Description

At most "max" characters will be extracted.

 
 top of page
Method gunzip
Uncompress the given source buffer.
Signature
gunzip(Buffersrc,
  intoff,
  intlen,
  intuncompressedSize 
  )  
Arguments
BuffersrcWhich buffer to uncompress
intoffSource buffer offset
intlenCompressed size
intuncompressedSize(maximum) Uncompressed size
Description

This buffer will be resized to the uncompressed size.

 
 top of page
Method gzip
Compress the given source buffer.
Signature
gzip(Buffersrc,
  intoff,
  intlen,
  intlevel 
  )  
 :boolean
Arguments
BuffersrcWhich buffer to compress
intoffSource offset
intlenNumber of bytes to compress
intlevelCompression level (0..9)
Returns
booleantrue if the given buffer has been compressed successfully, false otherwise.
Description

This buffer will be resized to the compressed size.

 
 top of page
Method hexdump
Debug-print buffer(area) to console.
Signature
hexdump(intnum)
 :int start
Arguments
intnum
Returns
int start

 
 top of page
Method peekF32
Read 32bit single precision floating point value from the given buffer offset.
Signature
peekF32(intoff)
 :float
Arguments
intoffWhere to read the 32bit floating point value from
Returns
float32bit single precision floating point value

 
 top of page
Method peekI14
Read short 7:7 integer from the given buffer offset.
Signature
peekI14(intoff)
 :short
Arguments
intoffWhere to read the short integer from
Returns
shortShort integer
Description

The return value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method peekI16
Read unsigned short integer from the given buffer offset.
Signature
peekI16(intoff)
 :short
Arguments
intoffWhere to read the short integer from
Returns
shortShort integer
Description

The return value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method peekI32
Read unsigned 32bit integer from the given buffer offset.
Signature
peekI32(intoff)
 :int
Arguments
intoffWhere to read the 32bit integer from
Returns
int32bit integer
Description

The return value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method peekI8
Read unsigned byte from the given buffer offset
Signature
peekI8(intoff)
 :byte
Arguments
intoffWhere to read the byte from
Returns
byteByte

 
 top of page
Method peekS16
Read signed short integer from the given buffer offset.
Signature
peekS16(intoff)
 :short
Arguments
intoffWhere to read the short integer from
Returns
shortShort integer
Description

The return value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method peekS32
Read signed 32bit integer from the given buffer offset.
Signature
peekS32(intoff)
 :int
Arguments
intoffWhere to read the 32bit integer from
Returns
int32bit integer
Description

The return value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method peekS8
Read signed byte from the given buffer offset
Signature
peekS8(intoff)
 :byte
Arguments
intoffWhere to read the byte from
Returns
byteByte

 
 top of page
Method pokeF32
Store 32bit single precision floating point value at the given buffer offset.
Signature
pokeF32(intoff,
  floatvalue 
  )  
Arguments
intoffWhere to store the floating point value
floatvalueWhich floating point value to store

 
 top of page
Method pokeI14
Store short 7:7 integer at the given buffer offset.
Signature
pokeI14(intoff,
  shortvalue 
  )  
Arguments
intoffWhere to store the short
shortvalueWhich short to store
Description

The value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method pokeI16
Store short integer at the given buffer offset.
Signature
pokeI16(intoff,
  shortvalue 
  )  
Arguments
intoffWhere to store the short
shortvalueWhich short to store
Description

The value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method pokeI32
Store 32bit integer at the given buffer offset.
Signature
pokeI32(intoff,
  intvalue 
  )  
Arguments
intoffWhere to store the 32bit integer
intvalueWhich 32bit integer to store
Description

The value byteorder will be swapped according to the current buffer byteorder.

 
 top of page
Method pokeI8
Store byte at the given buffer offset
Signature
pokeI8(intoff,
  bytevalue 
  )  
Arguments
intoffWhere to storethe byte
bytevalueWhich byte to store

 
 top of page
Method readBufferBits
Treat buffer as bitstream and read up to 32 bits from the given start bit offset.
Signature
readBufferBits(intnumBits)
 :int
Arguments
intnumBitsNumber of bits (up to 32)
Returns
intValue

 
 top of page
Method resize
Change the size of the buffer.
Signature
resize(intnum)
 :boolean
Arguments
intnumNew buffer size
Returns
booleantrue if the reallocation succeeded, false otherwise

 
 top of page
Method ringReadBuffer
Copy ringbuffer area within this buffer to dst buffer.
Signature
ringReadBuffer(intringStartOff,
  intringSz,
  Bufferdst,
  intdstOff,
  intnumBytes 
  )  
Arguments
intringStartOffStart of ringbuffer area
intringSzRingbuffer size
Bufferdst
intdstOffWrite offset
intnumBytesNumber of bytes

 
 top of page
Method ringWriteBuffer
Copy buffer data to ringbuffer area within this buffer.
Signature
ringWriteBuffer(intringStartOff,
  intringSz,
  Buffersrc,
  intsrcOff,
  intnumBytes 
  )  
Arguments
intringStartOffStart of ringbuffer area
intringSzRingbuffer size
BuffersrcSource buffer
intsrcOffRead offset
intnumBytesNumber of bytes

 
 top of page
Method setSize
Allocate the given number of bytes.
Signature
setSize(intnum)
 :boolean
Arguments
intnumNew buffer size
Returns
booleantrue if the allocation succeeded, false otherwise

 
 top of page
Method setString
Store 0 terminated string at the given buffer offset.
Signature
setString(intoff,
  Strings 
  )  
 :boolean
Arguments
intoffWhere to store the string
StringsWhich string to store
Returns
booleantrue if the string has been stored successfully, false otherwise

 
 top of page
Method substring
Extract 0 terminated string from buffer.
Signature
substring(Stringr,
  intoff,
  intmax 
  )  
Arguments
StringrReceives the extracted string
intoffBuffer offset
intmaxMaximum number of characters to extract
Description

The result will be written to String "r".At most "max" characters will be written.

 
 top of page
Method truncate
Truncate buffer size (w/o reallocation).
Signature
truncate():int sz
Returns
int sz
Description

Current size must be >= 'sz'.

 
 top of page
Method visit
Create view into other buffer.
Signature
visit(intoff,
  intlen 
  )  
 :Buffer b
Arguments
intoffSource buffer offset
intlenArea size
Returns
Buffer btrue if the source buffer is allocated and the area is within bounds, false otherwise.
Description

The previous content of this buffer will be freed.
Make sure to keep the source buffer alive as long as the visited data in this buffer is accessed.

 
 top of page
Method writeBufferBits
Treat buffer as bitstream and write up to 32 bits to the given start bit offset.
Signature
writeBufferBits(intnumBits,
  intval 
  )  
 :int startBit
Arguments
intnumBitsNumber of bits (up to 32)
intvalValue to store into buffer
Returns
int startBitValue

 
 top of page
 

Project Modules:core 
Project Classes:Boolean , Buffer , Byte , Class , ClassArray , Condition , Configuration , Double , DummyStream , Envelope , Event , Exception , File , Float , FloatArray , FloatArray128 , FloatArray16 , FloatArray32 , FloatArray64 , FloatArray8 , Function , HashTable , IntArray , IntArray128 , IntArray16 , IntArray32 , IntArray64 , IntArray8 , Integer , LFSR , LFSR_NR , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , Process , Script , SharedBuffer , Short , Stack , StdErrStream , StdInStream , StdOutStream , Stream , String , String128 , String16 , String32 , String64 , String8 , StringArray , StringIterator , Thread , Time , TKS , TreeNode , UnsignedByte , UnsignedInteger , UnsignedLong , UnsignedShort , Value , ValueArray , Variable 
Project Functions:ceil , exit , floor , GetCurrentThread , getenv , lcchar , mathAbsMaxf , mathAbsMinf , mathAbsMini , mathAbsMini , mathCerpf , mathClampf , mathClampi , mathDistancePointPlane2d , mathFoldf , mathFoldi , mathGCD , mathLerpCyclicf , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathNextCyclicf , mathPowerf , mathPowerfC , mathPoweri , mathSerpf , mathSmoothStepf , mathSmoothStepNf , mathWrapf , mathWrapi , milliSeconds , milliSecondsDouble , psystem , putenv , srand , system , ucchar 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Thu, 11/Dec/2025 13:41:59