org.python.modules
Class cStringIO.StringIO

java.lang.Object
  extended byorg.python.core.PyObject
      extended byorg.python.modules.cStringIO.StringIO
All Implemented Interfaces:
Serializable
Enclosing class:
cStringIO

public static class cStringIO.StringIO
extends PyObject

The StringIO object

See Also:
cStringIO.StringIO(), cStringIO.StringIO(String), Serialized Form

Field Summary
 boolean closed
           
 String mode
           
 String name
           
 boolean softspace
           
 
Fields inherited from class org.python.core.PyObject
__class__
 
Method Summary
 void __setattr__(String name, PyObject value)
          A variant of the __setattr__ method which accepts a String as the key.
 void close()
          Free the memory buffer.
 void flush()
          Flush the internal buffer.
 String getvalue()
          Retrieve the entire contents of the ``file'' at any time before the StringIO object's close() method is called.
 boolean isatty()
          Return false.
 String read()
          Read all data until EOF is reached.
 String read(int size)
          Read at most size bytes from the file (less if the read hits EOF).
 String readline()
          Read one entire line from the file.
 String readline(int length)
          Read one entire line from the file.
 String readlineNoNl()
          Read and return a line without the trailing newling.
 PyObject readlines()
          Read until EOF using readline() and return a list containing the lines thus read.
 PyObject readlines(int sizehint)
          Read until EOF using readline() and return a list containing the lines thus read.
 void seek(long pos)
          Position the file pointer to the absolute position.
 void seek(long pos, int mode)
          Position the file pointer to the position in the .
 long tell()
          Return the file position.
 void truncate()
          truncate the file at the current position.
 void truncate(int pos)
          truncate the file at the position pos.
 void write(String s)
          Write a string to the file.
 void writeChar(char ch)
          Write a char to the file.
 void writelines(String[] lines)
          Write a list of strings to the file.
 
Methods inherited from class org.python.core.PyObject
__abs__, __add__, __and__, __anye__, __bde__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __cmp__, __coerce__, __coerce_ex__, __complex__, __contains__, __delattr__, __delattr__, __delitem__, __delitem__, __delslice__, __delslice__, __dir__, __div__, __divmod__, __eq__, __findattr__, __findattr__, __finditem__, __finditem__, __finditem__, __float__, __ge__, __getattr__, __getattr__, __getitem__, __getitem__, __getslice__, __getslice__, __gt__, __hash__, __hex__, __iadd__, __iand__, __idiv__, __idivmod__, __ilshift__, __imod__, __imul__, __int__, __invert__, __ior__, __ipow__, __irshift__, __isub__, __ixor__, __lde__, __le__, __len__, __like__, __long__, __lshift__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __not__, __oct__, __or__, __pos__, __pow__, __pow__, __radd__, __rand__, __rcontained__, __rcontains__, __rde__, __rdiv__, __rdivmod__, __repr__, __rexact__, __rlshift__, __rmod__, __rmul__, __ror__, __roverlaps__, __rpow__, __rrshift__, __rshift__, __rsub__, __rxor__, __setattr__, __setitem__, __setitem__, __setitem__, __setslice__, __setslice__, __str__, __str2__, __sub__, __tojava__, __xor__, _add, _and, _anye, _bde, _callextra, _cmp, _div, _divmod, _dodel, _doget, _doget, _doset, _eq, _ge, _gt, _in, _is, _isnot, _jcall, _jcallexc, _jthrow, _lde, _le, _like, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rcontained, _rcontains, _rde, _rexact, _roverlaps, _rshift, _sub, _xor, equals, hashCode, invoke, invoke, invoke, invoke, invoke, isCallable, isMappingType, isNumberType, isSequenceType, safeRepr
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

softspace

public transient boolean softspace

name

public transient String name

mode

public transient String mode

closed

public transient boolean closed
Method Detail

__setattr__

public void __setattr__(String name,
                        PyObject value)
Description copied from class: PyObject
A variant of the __setattr__ method which accepts a String as the key. This String must be interned.

Overrides:
__setattr__ in class PyObject
Parameters:
name - the name whose value will be set - must be an interned string .
value - the value to set this name to
See Also:
PyObject.__setattr__(PyString, PyObject)

close

public void close()
Free the memory buffer.


isatty

public boolean isatty()
Return false.

Returns:
false.

seek

public void seek(long pos)
Position the file pointer to the absolute position.

Parameters:
pos - the position in the file.

seek

public void seek(long pos,
                 int mode)
Position the file pointer to the position in the .

Parameters:
pos - the position in the file.

tell

public long tell()
Return the file position.


read

public String read()
Read all data until EOF is reached. An empty string is returned when EOF is encountered immediately.


read

public String read(int size)
Read at most size bytes from the file (less if the read hits EOF). If the size argument is negative, read all data until EOF is reached. An empty string is returned when EOF is encountered immediately.

Parameters:
size - the number of characters to read.

readline

public String readline()
Read one entire line from the file. A trailing newline character is kept in the string (but may be absent when a file ends with an incomplete line). An empty string is returned when EOF is hit immediately.


readline

public String readline(int length)
Read one entire line from the file. A trailing newline character is kept in the string (but may be absent when a file ends with an incomplete line). If the size argument is non-negative, it is a maximum byte count (including the trailing newline) and an incomplete line may be returned.


readlineNoNl

public String readlineNoNl()
Read and return a line without the trailing newling. Usind by cPickle as an optimization.


readlines

public PyObject readlines()
Read until EOF using readline() and return a list containing the lines thus read.

Returns:
a list of the lines.

readlines

public PyObject readlines(int sizehint)
Read until EOF using readline() and return a list containing the lines thus read.

Returns:
a list of the lines.

truncate

public void truncate()
truncate the file at the current position.


truncate

public void truncate(int pos)
truncate the file at the position pos.


write

public void write(String s)
Write a string to the file.

Parameters:
s - The data to write.

writeChar

public void writeChar(char ch)
Write a char to the file. Used by cPickle as an optimization.

Parameters:
ch - The data to write.

writelines

public void writelines(String[] lines)
Write a list of strings to the file.


flush

public void flush()
Flush the internal buffer. Does nothing.


getvalue

public String getvalue()
Retrieve the entire contents of the ``file'' at any time before the StringIO object's close() method is called.

Returns:
the contents of the StringIO.