Gjsify LogoGjsify Logo

A data buffer, generally used to represent a chunk of a #SoupMessageBody.

data is a #char because that's generally convenient; in some situations you may need to cast it to #guchar or another type.

record

Hierarchy

  • Buffer

Index

Constructors

  • Creates a new #SoupBuffer containing length bytes from data.

    This function is exactly equivalent to soup_buffer_new() with %SOUP_MEMORY_TAKE as first argument; it exists mainly for convenience and simplifying language bindings.

    Parameters

    • data: Uint8Array

      data

    Returns Soup.Buffer

Properties

data: object

the data

field
length: number

length of data

field
name: string

Methods

  • Makes a copy of buffer. In reality, #SoupBuffer is a refcounted type, and calling soup_buffer_copy() will normally just increment the refcount on buffer and return it. However, if buffer was created with #SOUP_MEMORY_TEMPORARY memory, then soup_buffer_copy() will actually return a copy of it, so that the data in the copy will remain valid after the temporary buffer is freed.

    Returns Soup.Buffer

  • free(): void
  • Frees buffer. (In reality, as described in the documentation for soup_buffer_copy(), this is actually an "unref" operation, and may or may not actually free buffer.)

    Returns void

  • getAsBytes(): any
  • Creates a #GBytes pointing to the same memory as buffer. The #GBytes will hold a reference on buffer to ensure that it is not freed while the #GBytes is still valid.

    Returns any

  • getData(): Uint8Array
  • This function exists for use by language bindings, because it's not currently possible to get the right effect by annotating the fields of #SoupBuffer.

    Returns Uint8Array

  • getOwner(): object
  • Gets the "owner" object for a buffer created with soup_buffer_new_with_owner().

    Returns object

  • newSubbuffer(offset: number, length: number): Soup.Buffer
  • Creates a new #SoupBuffer containing length bytes "copied" from parent starting at offset. (Normally this will not actually copy any data, but will instead simply reference the same data as parent does.)

    Parameters

    • offset: number

      offset within parent to start at

    • length: number

      number of bytes to copy from parent

    Returns Soup.Buffer

  • Creates a new #SoupBuffer containing length bytes from data.

    This function is exactly equivalent to soup_buffer_new() with %SOUP_MEMORY_TAKE as first argument; it exists mainly for convenience and simplifying language bindings.

    Parameters

    • data: Uint8Array

      data

    Returns Soup.Buffer

  • Creates a new #SoupBuffer containing length bytes from data. When the #SoupBuffer is freed, it will call owner_dnotify, passing owner to it. You must ensure that data will remain valid until owner_dnotify is called.

    For example, you could use this to create a buffer containing data returned from libxml without needing to do an extra copy:

    xmlDocDumpMemory (doc, &xmlbody, &len); return soup_buffer_new_with_owner (xmlbody, len, xmlbody, (GDestroyNotify)xmlFree);

    In this example, data and owner are the same, but in other cases they would be different (eg, owner would be a object, and data would be a pointer to one of the object's fields).

    Parameters

    • data: Uint8Array

      data

    • owner: object

      pointer to an object that owns data

    • ownerDnotify: GLib.DestroyNotify

      a function to free/unref owner when the buffer is freed

    Returns Soup.Buffer

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method