maxon.InputStreamInterface

Description

Interface for input streams. It allows to read data from streams.
This interface needs to be implemented for each protocol.

Inheritance diagram

Inheritance

Parent Class:

Children Classes:

Methods Signature

BytesAvailable()

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.

Read([len, chunk])

Reads all bytes up to len bytes of data from the input stream into an array of bytes.

ReadEOS(data)

Reads up to len bytes of data from the input stream into an array of bytes.

Skip(bytes)

Skips over and discards n bytes of data from this input stream.

read([n])

Methods Definition

InputStreamInterface.BytesAvailable()

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.

Returns

Available number of bytes to read/skip.

Return type

int

InputStreamInterface.Read(len=None, chunk=io.DEFAULT_BUFFER_SIZE)

Reads all bytes up to len bytes of data from the input stream into an array of bytes. ‘bytes’ and the result are of type Int (not Int64) as ‘buffer’ can never hold more bytes on a 32-bit system.

Parameters
  • len (int) – size of buffer to read.

  • chunk – The type of the data to read

Returns

The buffer with the data.

Return type

bytes

InputStreamInterface.ReadEOS(data)

Reads up to len bytes of data from the input stream into an array of bytes. ‘bytes’ and the result are of type Int (not Int64) as ‘buffer’ can never hold more bytes on a 32-bit system.

Parameters

data (maxon.Block) – Buffer which receives the read bytes.

Returns

Number of bytes that has been read. If less bytes read than requested the end of

the stream has been reached.

Return type

int

InputStreamInterface.Skip(bytes)
Skips over and discards n bytes of data from this input stream.
If you want to BaseStreamInterface.Seek() forward InputStreamInterface.Skip() is the preferred method to call from the performance perspective.
Parameters

bytes (bytes) – Number of bytes to skip from the current position.

InputStreamInterface.read(n=- 1)