# cocos.audio.SDL.rwops module

General interface for SDL to read and write data sources.

For files, use SDL_RWFromFile. Other Python file-type objects can be used with SDL_RWFromObject. If another library provides a constant void pointer to a contiguous region of memory, SDL_RWFromMem and SDL_RWFromConstMem can be used.

class `SDL_RWops`

  Bases: `_ctypes.Structure`

  Read/write operations structure.

  Ivariables: | seek : function seek(context: SDL_RWops, offset: int, whence: int) -> int read : function read(context: SDL_RWops, ptr: c_void_p, size: int, maxnum: int) -> int write : function write(context: SDL_RWops, ptr: c_void_p, size: int, num: int) -> int close : function close(context: SDL_RWops) -> int type : int Undocumented

  `close`

    Structure/Union member

  `read`

    Structure/Union member

  `seek`

    Structure/Union member

  `type`

    Structure/Union member

  `write`

    Structure/Union member

`SDL_RWFromConstMem`(*args, **kwargs)

  These functions shouldn’t be useful to Pythoners. SDL_AllocRW = dll.function(‘SDL_AllocRW’,

  System Message: ERROR/3 (`D:\cocos_pristine\cocos2d-python\cocos\audio\SDL\rwops.py:docstring of cocos.audio.SDL.rwops.SDL_RWFromConstMem`, line 3)

  Unexpected indentation.

  > ‘’‘Allocate a blank SDL_Rwops structure.

  > rtype: | SDL_RWops

  > System Message: WARNING/2 (`D:\cocos_pristine\cocos2d-python\cocos\audio\SDL\rwops.py:docstring of cocos.audio.SDL.rwops.SDL_RWFromConstMem`, line 6)

  > Field list ends without a blank line; unexpected unindent.

  > ‘’’ args=[], arg_types=[], return_type=POINTER(SDL_RWops), dereference_return=True, require_return=True)

  SDL_FreeRW = dll.function(‘SDL_FreeRW’,

    ‘’‘Free a SDL_RWops structure.

    param area: | SDL_RWops

    System Message: WARNING/2 (`D:\cocos_pristine\cocos2d-python\cocos\audio\SDL\rwops.py:docstring of cocos.audio.SDL.rwops.SDL_RWFromConstMem`, line 17)

    Field list ends without a blank line; unexpected unindent.

    ‘’’ args=[‘area’], arg_types=[POINTER(SDL_RWops)], return_type=None)

`SDL_RWFromObject`(obj)

  Construct an SDL_RWops structure from a Python file-like object.

  The object must support the following methods in the same fashion as the builtin file object:

  > - `read(len) -> data`
  > - `write(data)`
  > - `seek(offset, whence)`
  > - `close()`

  Parameters: | obj: Python file-like object to wrap
  Return type: | SDL_RWops