Class: Fox::FXMemoryStream

Inherits:
FXStream show all
Defined in:
rdoc-sources/FXMemoryStream.rb,
lib/fox16/iterators.rb

Overview

A FXMemoryStream is a stream that reads from (or writes to) a buffer of bytes in memory. That buffer may "owned" by either the application code or by the stream object itself. In the latter case, the stream object will dispose of the buffer contents when the stream is closed.

Instance Attribute Summary collapse

Attributes inherited from FXStream

#container, #direction, #space, #status

Instance Method Summary collapse

Methods inherited from FXStream

#bigEndian=, #bigEndian?, #bytesSwapped=, #bytesSwapped?, #close, #eof?, #error=, #flush, #getSpace, #setSpace

Constructor Details

#initialize(cont = nil) ⇒ FXMemoryStream

Construct a new memory stream with given container object. The container object is an object that will itself not be saved to or loaded from the stream, but which may be referenced by other objects. These references will be properly saved and restored.

Parameters:

cont

the container object, or nil if there is none Fox::FXObject.



22
23
# File 'rdoc-sources/FXMemoryStream.rb', line 22

def initialize(cont=nil) # :yields: theMemoryStream
end

Instance Attribute Details

#position ⇒ Object (readonly)

Returns the value of attribute position.



10
11
12
# File 'rdoc-sources/FXMemoryStream.rb', line 10

def position
  @position
end

Instance Method Details

#giveBuffer(buffer) ⇒ Object

Give buffer (a string) to this stream, thus transferring ownership of the buffer from the caller to the stream object.



47
# File 'rdoc-sources/FXMemoryStream.rb', line 47

def giveBuffer(buffer); end

#open(save_or_load, data) ⇒ Object

Open memory stream for reading or writing. Returns true if successful, false otherwise.

Parameters:

save_or_load

access mode, either FXStreamSave or FXStreamLoad [Integer]

data

memory buffer to be used for the stream, or nil if the stream object should allocate its own buffer [String]



34
# File 'rdoc-sources/FXMemoryStream.rb', line 34

def open(save_or_load, data); end

#takeBuffer ⇒ Object

Take buffer away from stream, thus transferring ownership of the buffer from the stream object to the caller. Returns a string containing the buffer contents.



41
# File 'rdoc-sources/FXMemoryStream.rb', line 41

def takeBuffer; end