public class PyIOBase extends PyObject implements FinalizableBuiltin, Traverseproc
_io._IOBase, on which the io module depends directly.
 
 Implementation note: The code is based heavily on the Jython 2.6-ish
 _fileio.PyFileIO, the purely Java-accessible IOBase (both
 Philip Jenvey's work), and the Python implementation in Lib/_pyio. We do not simply
 delegate to the implementation in org.python.core.io because of the need to override
 parts of the implementation in Python subclasses. A call to close(), for example, is
 required to call flush(), but if delegated to the pure Java implementation would not
 call the version of flush() overridden in a Python sub-class of
 _io._IOBase. Equally, the use made by PyRawIOBase.read(int) of
 readinto(bytearray) would not pick up the version of readinto defined
 in Python.
PyObject.ConversionException| Modifier and Type | Field and Description | 
|---|---|
| static String | close_doc | 
| static String | closed_doc | 
| static String | fileno_doc | 
| static String | flush_doc | 
| static String | isatty_doc | 
| static String | readable_doc | 
| static String | readline_doc | 
| static String | readlines_doc | 
| static String | seek_doc | 
| static String | seekable_doc | 
| static String | tell_doc | 
| static String | truncate_doc | 
| static PyType | TYPE | 
| static String | writable_doc | 
| static String | writelines_doc | 
gcMonitorGlobal| Modifier and Type | Method and Description | 
|---|---|
| void | __del_builtin__()FinalizableBuiltin.__del_builtin__()is the built-in's own finalizer, whileFinalizablePyObjectDerived.__del_derived__()refers to an
 instance's in-dict__del__. | 
| PyObject | __enter__()Called at the start of a context-managed suite (supporting the  withclause). | 
| boolean | __exit__(PyObject type,
        PyObject value,
        PyObject traceback)Called at the end of a context-managed suite (supporting the  withclause), and
 will normally close the stream. | 
| PyObject | __iter__()Return an iterator on which  nextmay be repeatedly called to produce (usually)
 lines from this stream or file. | 
| PyObject | __iternext__()Return the next element of the sequence that this is an iterator
 for. | 
| void | _checkClosed() | 
| void | _checkClosed(String msg)Raise an error if the underlying IO stream is closed. | 
| void | _checkReadable()Raise an error if the underlying IO stream is not readable. | 
| void | _checkReadable(String msg)Raise an error if the underlying IO stream is not readable. | 
| void | _checkSeekable()Raise an error if the pointer of underlying IO stream is not capable of being
 positioned. | 
| void | _checkSeekable(String msg)Raise an error if the pointer of underlying IO stream is not capable of being
 positioned. | 
| void | _checkWritable()Raise an error if the underlying IO stream is not writable. | 
| void | _checkWritable(String msg)Raise an error if the underlying IO stream is not writable. | 
| void | close()Close the stream. | 
| void | closed_readonly(boolean value) | 
| boolean | closed()Is the stream closed against further client operations? | 
| PyStringMap | fastGetDict()xxx implements where meaningful | 
| PyObject | fileno()Return a file descriptor for the stream. | 
| void | flush()Flush write buffers, or no-op for read-only and non-blocking streams. | 
| boolean | isatty()Is the stream known to be an interactive console? | 
| PyObject | next()May be called repeatedly to produce (usually) lines from this stream or file. | 
| boolean | readable()Is the stream readable? | 
| PyObject | readline()Return one line of text (bytes terminates by  '\n'), or the whole stream,
 whichever is shorter. | 
| PyObject | readline(int limit)Return one line of text (bytes terminates by  '\n'), or the specified number of
 bytes, or the whole stream, whichever is shortest. | 
| PyObject | readlines(PyObject hint)Read a stream as a sequence of lines. | 
| boolean | refersDirectlyTo(PyObject ob)Optional operation. | 
| long | seek(long pos)Position the read or write pointer at a given byte offset  posrelative to the
 start. | 
| long | seek(long pos,
    int whence)Position the read or write pointer at a given byte offset  posrelative to a
 position indicated bywhence. | 
| boolean | seekable()Is the stream capable of positioning the read/write pointer? | 
| long | tell()Get the current stream position. | 
| int | traverse(Visitproc visit,
        Object arg)Traverses all directly contained  PyObjects. | 
| long | truncate()Truncate file to  sizebytes to the current position (as reported bytell()). | 
| long | truncate(long size)Truncate file to  sizebytes. | 
| boolean | writable()Is the stream writable? | 
| void | writelines(PyObject lines)Write an iterable sequence of strings to the stream. | 
__abs__, __add__, __and__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __cmp__, __coerce__, __coerce_ex__, __complex__, __contains__, __delattr__, __delattr__, __delete__, __delitem__, __delitem__, __delslice__, __delslice__, __dir__, __div__, __divmod__, __ensure_finalizer__, __eq__, __findattr__, __findattr__, __findattr_ex__, __finditem__, __finditem__, __finditem__, __float__, __floordiv__, __format__, __ge__, __get__, __getattr__, __getattr__, __getitem__, __getitem__, __getnewargs__, __getslice__, __getslice__, __gt__, __hash__, __hex__, __iadd__, __iand__, __idiv__, __idivmod__, __ifloordiv__, __ilshift__, __imod__, __imul__, __index__, __int__, __invert__, __ior__, __ipow__, __irshift__, __isub__, __itruediv__, __ixor__, __le__, __len__, __long__, __lshift__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __not__, __oct__, __or__, __pos__, __pow__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __reduce__, __reduce_ex__, __reduce_ex__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __set__, __setattr__, __setattr__, __setitem__, __setitem__, __setitem__, __setslice__, __setslice__, __str__, __sub__, __tojava__, __truediv__, __trunc__, __unicode__, __xor__, _add, _and, _callextra, _cmp, _div, _divmod, _doget, _doget, _doset, _eq, _floordiv, _ge, _gt, _iadd, _iand, _idiv, _idivmod, _ifloordiv, _ilshift, _imod, _imul, _in, _ior, _ipow, _irshift, _is, _isnot, _isub, _itruediv, _ixor, _jcall, _jcallexc, _jthrow, _le, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rshift, _sub, _truediv, _xor, asDouble, asIndex, asIndex, asInt, asInt, asIterable, asLong, asLong, asName, asName, asString, asString, asStringOrNull, asStringOrNull, bit_length, conjugate, delDict, delType, dispatch__init__, equals, fastGetClass, getDict, getType, hashCode, implementsDescrDelete, implementsDescrGet, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isIndex, isInteger, isMappingType, isNumberType, isSequenceType, noAttributeError, object___subclasshook__, readonlyAttributeError, setDict, setType, toStringpublic static final PyType TYPE
public static final String seek_doc
public static final String tell_doc
public static final String truncate_doc
public static final String flush_doc
public static final String close_doc
public static final String closed_doc
public static final String seekable_doc
public static final String readable_doc
public static final String writable_doc
public static final String fileno_doc
public static final String isatty_doc
public static final String readline_doc
public static final String readlines_doc
public static final String writelines_doc
public PyStringMap fastGetDict()
PyObjectfastGetDict in class PyObjectpublic long seek(long pos,
                 int whence)
pos relative to a
 position indicated by whence.
 whence=0, the position will be set to pos bytes.whence=1 the position will be set to the current position plus
 pos.whence=2 the position will be set to the stream size plus
 pos (and usually pos<=0).pos - relative to the specified pointwhence - 0=from start, 1=from here, 2=from endpublic final long seek(long pos)
pos relative to the
 start.pos - relative to the startpublic long tell()
public long truncate(long size)
size bytes.size - requested for streampublic long truncate()
size bytes to the current position (as reported by
 tell()).public void flush()
public final void closed_readonly(boolean value)
public void close()
public boolean seekable()
                 throws PyException
True if may be positionedPyException(ValueError) - if the object is closed to client operationsPyExceptionpublic void _checkSeekable(String msg)
msg - optional custom messagePyException(ValueError) - if the object is closed to client operationsPyException(IOError) - if the stream is not capable of being positioned.public final void _checkSeekable()
PyException(ValueError) - if the object is closed to client operationsPyException(IOError) - if the stream is not capable of being positioned.public boolean readable()
                 throws PyException
true if readablePyException(ValueError) - if the object is closed to client operationsPyExceptionpublic void _checkReadable(String msg)
msg - optional custom messagePyException(ValueError) - if the object is closed to client operationsPyException(IOError) - if the stream is not readable.public final void _checkReadable()
PyException(ValueError) - if the object is closed to client operationsPyException(IOError) - if the stream is not readable.public boolean writable()
                 throws PyException
true if writablePyException(ValueError) - if the object is closed to client operationsPyExceptionpublic void _checkWritable(String msg) throws PyException
msg - optional custom messagePyException(ValueError) - if the object is closed to client operationsPyException(IOError) - if the stream is not writable.PyExceptionpublic final void _checkWritable()
                          throws PyException
PyException(ValueError) - if the object is closed to client operationsPyException(IOError) - if the stream is not writable.PyExceptionpublic final boolean closed()
true if closedpublic void _checkClosed(String msg) throws PyException
_checkSeekable(java.lang.String), etc..msg - optional custom messagePyException(ValueError) - if the object is closed to client operationsPyExceptionpublic final void _checkClosed()
                        throws PyException
PyExceptionpublic PyObject __enter__()
with clause).public boolean __exit__(PyObject type, PyObject value, PyObject traceback)
with clause), and
 will normally close the stream.public PyObject fileno()
_jyio.open(PyObject[], String[]) accepts the type that RawIOBase.fileno()
 returns.public boolean isatty()
true if a console: false if not or we can't tellpublic PyObject readline(int limit)
'\n'), or the specified number of
 bytes, or the whole stream, whichever is shortest.limit - maximum number of bytes (<0 means no limit)public PyObject readline()
'\n'), or the whole stream,
 whichever is shorter.public PyObject __iter__()
next may be repeatedly called to produce (usually)
 lines from this stream or file.public PyObject __iternext__()
PyObject__iternext__ in class PyObjectpublic PyObject next() throws PyException
PyException(StopIteration) - when iteration has reached a natural conclusionPyException(ValueError) - if the file or stream is closedPyException(IOError) - reflecting an I/O error in during the readPyExceptionpublic PyObject readlines(PyObject hint)
hint - stop reading lines after this many bytes (if not EOF first)public void writelines(PyObject lines)
lines - public void __del_builtin__()
FinalizableBuiltinFinalizableBuiltin.__del_builtin__() is the built-in's own finalizer, while
 FinalizablePyObjectDerived.__del_derived__() refers to an
 instance's in-dict __del__.
 A FinalizeTrigger calls FinalizablePyObjectDerived.__del_derived__()
 first and - if existent - FinalizableBuiltin.__del_builtin__() after that. A plain
 FinalizablePyObject.__del__()
 would behave as overridden by
 FinalizablePyObjectDerived.__del_derived__(), i.e. won't be called
 if the type implements FinalizablePyObjectDerived, while
 FinalizableBuiltin.__del_builtin__() is called in any case.__del_builtin__ in interface FinalizableBuiltinpublic int traverse(Visitproc visit, Object arg)
TraverseprocPyObjects.
 Like in CPython, arg must be passed
 unmodified to visit as its second parameter.
 If Visitproc.visit(PyObject, Object) returns
 nonzero, this return value
 must be returned immediately by traverse.
 
 Visitproc.visit(PyObject, Object) must not be
 called with a null PyObject-argument.traverse in interface Traverseprocpublic boolean refersDirectlyTo(PyObject ob)
TraverseprocTraverseproc.traverse(Visitproc, Object) with
 a visitproc that just watches out for ob.
 Must return false if ob is null.refersDirectlyTo in interface Traverseproc