gi-glib-2.0.13: GLib bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.GLib.Structs.ByteArray

Contents

Description

Contains the public fields of a GByteArray.

Synopsis

Exported types

newZeroByteArray :: MonadIO m => m ByteArray Source #

Construct a ByteArray struct initialized to zero.

Methods

free

byteArrayFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

array: a ByteArray

-> Bool

freeSegment: if True the actual byte data is freed as well

-> m Word8

Returns: the element data if freeSegment is False, otherwise Nothing. The element data should be freed using free.

Frees the memory allocated by the ByteArray. If freeSegment is True it frees the actual byte data. If the reference count of array is greater than one, the ByteArray wrapper is preserved but the size of array will be set to zero.

freeToBytes

byteArrayFreeToBytes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

array: a ByteArray

-> m Bytes

Returns: a new immutable Bytes representing same byte data that was in the array

Transfers the data from the ByteArray into a new immutable Bytes.

The ByteArray is freed unless the reference count of array is greater than one, the ByteArray wrapper is preserved but the size of array will be set to zero.

This is identical to using bytesNewTake and byteArrayFree together.

Since: 2.32

new

byteArrayNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ByteString

Returns: the new ByteArray

Creates a new ByteArray with a reference count of 1.

newTake

byteArrayNewTake Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

data: byte data for the array

-> m ByteString

Returns: a new ByteArray

Create byte array containing the data. The data will be owned by the array and will be freed with free, i.e. it could be allocated using strdup.

Since: 2.32

unref

byteArrayUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

array: A ByteArray

-> m () 

Atomically decrements the reference count of array by one. If the reference count drops to 0, all memory allocated by the array is released. This function is thread-safe and may be called from any thread.

Since: 2.22

Properties

data

len