Package echonest :: Package remix :: Package support :: Package midi :: Module RawInstreamFile :: Class RawInstreamFile
[hide private]
[frames] | no frames]

Class RawInstreamFile

source code

It parses and reads data from an input file. It takes care of big endianess, and keeps track of the cursor position. The midi parser only reads from this object. Never directly from the file.
Instance Methods [hide private]
 
__init__(self, infile='')
If 'file' is a string we assume it is a path and read from that file. If it is a file descriptor we read from the file, but we don't close it. Midi files are usually pretty small, so it should be safe to copy them into memory.
source code
 
setData(self, data='')
Sets the data from a string.
source code
 
setCursor(self, position=0)
Sets the absolute position if the cursor
source code
 
getCursor(self)
Returns the value of the cursor
source code
 
moveCursor(self, relative_position=0)
Moves the cursor to a new relative position
source code
 
nextSlice(self, length, move_cursor=1)
Reads the next text slice from the raw data, with length
source code
 
readBew(self, n_bytes=1, move_cursor=1)
Reads n bytes of date from the current cursor position. Moves cursor if move_cursor is true
source code
 
readVarLen(self)
Reads a variable length value from the current cursor position. Moves cursor if move_cursor is true
source code