EndianInput

class EndianInput(byteStream, byteOrder=None)[source]

Bases: object

This class handles the conversion of a byte stream as opened from a file in ‘rb’ mode to values needed by the pyasdm objects.

The class is intialized with an io.BufferedReader instance. This classes expects that seek works with that object.

Methods Summary

byteOrder()

Return the ByteOrder instance used by this EndianInput.

close()

Close the byte stream being read.

closed()

Returns True if the byte stream is closed.

readBool()

Return a bool using 1 byte in the byte list.

readByte()

Return the byte at the current location

readDouble()

Return the 8-byte float at the current location as a float.

readFloat()

Return the 4-byte float at the current location as a float.

readInt()

Return the signed 4-byte integer at the current location as a python int.

readLong()

Equivalent to readLongLong

readLongLong()

Return the signed 8-byte integer at the current location as a python int.

readShort()

Return the signed 2-byte integer at the current location as a python int.

readStr()

Identical to readString.

readString()

Return the string at the start of the current location.

readUInt()

Return the unsigned 4-byte integer at the current location as a python int.

readULongLong()

Return the unsigned 8-byte integer at the current location as a python int.

readUShort()

Return the unsigned short integer at the current location as a python int.

seek(offset)

Seek to some location in the stream being read.

tell()

Report the location of the byte stream.

Methods Documentation

byteOrder()[source]

Return the ByteOrder instance used by this EndianInput.

close()[source]

Close the byte stream being read.

closed()[source]

Returns True if the byte stream is closed.

readBool()[source]

Return a bool using 1 byte in the byte list.

readByte()[source]

Return the byte at the current location

readDouble()[source]

Return the 8-byte float at the current location as a float.

readFloat()[source]

Return the 4-byte float at the current location as a float.

readInt()[source]

Return the signed 4-byte integer at the current location as a python int.

readLong()[source]

Equivalent to readLongLong

readLongLong()[source]

Return the signed 8-byte integer at the current location as a python int.

readShort()[source]

Return the signed 2-byte integer at the current location as a python int.

readStr()[source]

Identical to readString. Used because the type of the string value in python is “str” and the template generator needs to use that type for various reasons in various palces and proving this here makes the tempalte code simpler.

readString()[source]

Return the string at the start of the current location.

String are encoded as a 4-byte int specifying the number of characters followed by those characters.

readUInt()[source]

Return the unsigned 4-byte integer at the current location as a python int.

readULongLong()[source]

Return the unsigned 8-byte integer at the current location as a python int.

readUShort()[source]

Return the unsigned short integer at the current location as a python int.

seek(offset)[source]

Seek to some location in the stream being read. This always seeks relative to the start of the stream.

Returns the new position (which should equal offset).

tell()[source]

Report the location of the byte stream.