public abstract class TextIOBase extends IOBase
Modifier and Type | Field and Description |
---|---|
static int |
CHUNK_SIZE
The size of chunks read for readline
|
DEFAULT_BUFFER_SIZE
Constructor and Description |
---|
TextIOBase(BufferedIOBase bufferedIO)
Contruct a TextIOBase wrapping the given BufferedIOBase.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
asInputStream()
Coerce this into an InputStream if possible, or return null.
|
OutputStream |
asOutputStream()
Coerce this into an OutputStream if possible, or return null.
|
void |
close()
Flushes and closes the IO object.
|
boolean |
closed()
Return whether this file has been closed.
|
RawIOBase |
fileno()
Returns underlying file descriptor if one exists.
|
void |
flush()
Flushes write buffers, if applicable.
|
PyObject |
getNewlines()
Return the known Newline types, as a PyObject, encountered
while reading this file.
|
boolean |
isatty()
Returns whether this is an 'interactive' stream.
|
String |
read(int size)
Read and return up to size bytes, contained in a String.
|
boolean |
readable()
Return whether this file was opened for reading.
|
String |
readall()
Read until EOF.
|
int |
readinto(PyObject buf)
Read into the given PyObject that implements the Jython buffer API (with write access) or is
a PyArray.
|
String |
readline(int size)
Read until size, newline or EOF.
|
long |
seek(long pos,
int whence)
Seek to byte offset pos relative to position indicated by whence: 0 Start of stream (the
default). pos should be >= 0; 1 Current position - whence may be negative; 2 End of stream -
whence usually negative.
|
long |
tell()
Return the current stream position.
|
long |
truncate(long pos)
Truncate file to size in bytes.
|
boolean |
writable()
Return whether this file was opened for writing.
|
int |
write(String buf)
Write the given String to the IO stream.
|
checkClosed, checkReadable, checkWritable, seek
public static final int CHUNK_SIZE
public TextIOBase(BufferedIOBase bufferedIO)
bufferedIO
- a BufferedIOBase to wrappublic String read(int size)
size
- the number of bytes to readpublic String readall()
public String readline(int size)
size
- the number of bytes to readpublic int readinto(PyObject buf)
buf
- a PyObject compatible with the buffer APIpublic int write(String buf)
buf
- a String valuepublic long truncate(long pos)
IOBase
public void flush()
IOBase
public void close()
IOBase
public long seek(long pos, int whence)
IOBase
public long tell()
IOBase
public RawIOBase fileno()
IOBase
public boolean isatty()
IOBase
public boolean readable()
IOBase
public boolean writable()
IOBase
public boolean closed()
IOBase
public InputStream asInputStream()
IOBase
asInputStream
in class IOBase
public OutputStream asOutputStream()
IOBase
asOutputStream
in class IOBase
public PyObject getNewlines()