Built-in Module ObjCStreams

ObjCStreams

The ObjCStreams module gets automatically imported whenever you import the ObjC module, and it's available as its .streams member. It encapsulates the underlying Objective-C streams facility into a Python class, ObjCStream: under NeXTSTEP it is built around the native NXStream library, while under GNUStep and OpenStep it actually uses a subclass of NSData.

The module provides the following methods:


\begin{funcdesc}{openfile}{filename \optional{, mode}}
Opens the given \var{file...
...EADONLY}, \code{.WRITEONLY}, \code{.READWRITE}
or \code{.APPEND}.
\end{funcdesc}


\begin{funcdesc}{openmemory}{string \optional{, mode}}
Opens a \dfn{memory strea...
...\code{.WRITEONLY}, the argument \var{string} must be \code{None}.
\end{funcdesc}


\begin{funcdesc}{openport}{machport \optional{, mode}}
Opens a MACH port as a stream and returns it.
\end{funcdesc}

The module has these data members:


\begin{datadesc}{READONLY}
This constant is used to open a stream in read-only mode.
\end{datadesc}


\begin{datadesc}{WRITEONLY}
This constant is used to open a stream in write-only mode.
\end{datadesc}


\begin{datadesc}{READWRITE}
This constant is used to open a stream in read-write mode.
\end{datadesc}


\begin{datadesc}{APPEND}
This constant is used to open a stream in read-write mode moving the
stream position at the end.
\end{datadesc}


\begin{datadesc}{FROMSTART}
This constant, used by the \code{seek()} method, specify that the
displacement is relative to the start of the stream.
\end{datadesc}


\begin{datadesc}{FROMEND}
This constant, used by the \code{seek()} method, specify that the
displacement is relative to the end of the stream.
\end{datadesc}


\begin{datadesc}{FROMCURRENT}
This constant, used by the \code{seek()} method, s...
...e
displacement is relative to the current position of the stream.
\end{datadesc}



Subsections