Panda3D
Public Member Functions | List of all members
Ramfile Class Reference

An in-memory buffer specifically designed for downloading files to memory. More...

Public Member Functions

 __init__ ()
 
 __init__ (const Ramfile)
 
 clear ()
 Empties the current buffer contents. More...
 
object getData ()
 Returns the entire buffer contents as a string, regardless of the current data pointer. More...
 
int getDataSize ()
 Returns the size of the entire buffer contents. More...
 
object read (int length)
 Extracts and returns the indicated number of characters from the current data pointer, and advances the data pointer. More...
 
object readline ()
 Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character. More...
 
object readlines ()
 
 seek (int pos)
 Moves the data pointer to the indicated byte position. More...
 
int tell ()
 Returns the current data pointer position as a byte offset from the beginning of the stream. More...
 

Detailed Description

An in-memory buffer specifically designed for downloading files to memory.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( const  Ramfile)

◆ clear()

clear ( )

Empties the current buffer contents.

◆ getData()

object getData ( )

Returns the entire buffer contents as a string, regardless of the current data pointer.

◆ getDataSize()

int getDataSize ( )

Returns the size of the entire buffer contents.

◆ read()

object read ( int  length)

Extracts and returns the indicated number of characters from the current data pointer, and advances the data pointer.

If the data pointer exceeds the end of the buffer, returns empty string.

The interface here is intentionally designed to be similar to that for Python's file.read() function.

◆ readline()

object readline ( )

Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character.

Returns empty string when the end of file is reached.

The interface here is intentionally designed to be similar to that for Python's file.readline() function.

◆ readlines()

object readlines ( )

◆ seek()

seek ( int  pos)

Moves the data pointer to the indicated byte position.

It is not an error to move the pointer past the end of data.

◆ tell()

int tell ( )

Returns the current data pointer position as a byte offset from the beginning of the stream.