Class PyRawIOBase

All Implemented Interfaces:
Serializable, FinalizableBuiltin, Traverseproc
Direct Known Subclasses:
PyFileIO, PyRawIOBaseDerived

public class PyRawIOBase extends PyIOBase
An implementation of Python _io._RawIOBase mirroring the arrangement of methods in the CPython version.
See Also:
  • Field Details

  • Constructor Details

    • PyRawIOBase

      public PyRawIOBase()
    • PyRawIOBase

      public PyRawIOBase(PyType subtype)
  • Method Details

    • read

      public PyObject read(int n)
      The read() method is implemented by calling readinto(); derived classes that want to support read() only need to implement readinto() as a primitive operation. In general, readinto() can be more efficient than read().
      Parameters:
      n - number of bytes to read (if possible)
      Returns:
      a PyString holding the bytes read or Py.None (when a non-blocking source is not ready with further data)
    • readall

      public PyObject readall()
      Read until end of file, using multiple read() operations on the underlying stream. If the first read() returns None (only possible in the case of a non-blocking stream), this method returns None.
      Returns:
      a PyString holding the bytes read or Py.None (when a non-blocking source is not ready with further data)
    • readinto

      public PyObject readinto(PyObject b)
      Read up to len(b) bytes into bytearray b and return the number of bytes read. If the object is in non-blocking mode and no bytes are available, None is returned.";
      Parameters:
      b - byte array to try to fill
      Returns:
      number of bytes actually read or Py.None (when a non-blocking source is not ready with further data)
    • write

      public PyObject write(PyObject b)
      Write the given bytes or bytearray object to the underlying raw stream and return the number of bytes written.
      Parameters:
      b - buffer of bytes to be written
      Returns:
      the number of bytes written