| Modifier and Type | Field and Description |
|---|---|
| protected BufferedIOBase | bufferedIO
The underlying buffered i/o stream |
| protected StringBuilder | builder
Builds the final String returned from readline |
| public static final int | CHUNK_SIZE
The size of chunks read for readline |
| protected static final byte | CR_BYTE
Byte representation of the Carriage Return character |
| protected char[] | interimBuilder
An interim buffer for builder; readline loops move bytes into this array to avoid StringBuilder.append method calls |
| protected ByteBuffer | readahead
The readahead buffer. |
| Access | Constructor and Description |
|---|---|
| public | TextIOBase(BufferedIOBase
a BufferedIOBase to wrap bufferedIO)Contruct a TextIOBase wrapping the given BufferedIOBase. |
| Modifier and Type | Method and Description |
|---|---|
| public InputStream | asInputStream()
Overrides org. Coerce this into an InputStream if possible, or return null. |
| public OutputStream | asOutputStream()
Overrides org. Coerce this into an OutputStream if possible, or return null. |
| protected boolean | Returns: true if the file pointer is currently at EOFReturn true if the file pointer is currently at EOF. |
| protected void | |
| public void | |
| public boolean | |
| protected String | Returns: the result of builder.toString()Return the String result of the builder, and reset it/perform cleanup on it. |
| public RawIOBase | fileno()
Overrides org. Returns underlying file descriptor if one exists. |
| public void | |
| public PyObject | Returns: a PyObject containing all encountered Newlines, or NoneReturn the known Newline types, as a PyObject, encountered while reading this file. |
| public boolean | isatty()
Overrides org. Returns whether this is an 'interactive' stream. |
| protected void | packReadahead()
Restore the readahead to its original size (CHUNK_SIZE) if it was previously resized. |
| public String | Returns: a String containing the bytes readthe number of bytes to read size)Read and return up to size bytes, contained in a String. |
| public boolean | readable()
Overrides org. Return whether this file was opened for reading. |
| public String | |
| protected int | Returns: the amount of data readRead a chunk of data of size CHUNK_SIZE into the readahead buffer. |
| protected int | Returns: the amount of data readthe desired size of the chunk size)Read a chunk of data of the given size into the readahead buffer. |
| public int | |
| public String | Returns: a String containing the bytes readthe number of bytes to read size)Read until size, newline or EOF. |
| public long | seek(long
a long position value pos, int an int whence value whence)Overrides org. Seek to byte offset |
| public long | |
| public long | truncate(long
a long size to truncate to pos)Overrides org. Truncate file to size in bytes. |
| public boolean | writable()
Overrides org. Return whether this file was opened for writing. |
| public int |
| bufferedIO | back to summary |
|---|---|
| protected BufferedIOBase bufferedIO The underlying buffered i/o stream | |
| builder | back to summary |
|---|---|
| protected StringBuilder builder Builds the final String returned from readline | |
| CHUNK_SIZE | back to summary |
|---|---|
| public static final int CHUNK_SIZE The size of chunks read for readline | |
| CR_BYTE | back to summary |
|---|---|
| protected static final byte CR_BYTE Byte representation of the Carriage Return character | |
| interimBuilder | back to summary |
|---|---|
| protected char[] interimBuilder An interim buffer for builder; readline loops move bytes into this array to avoid StringBuilder.append method calls | |
| readahead | back to summary |
|---|---|
| protected ByteBuffer readahead The readahead buffer. Though the underlying stream is sometimes buffered, readahead is specific to the TextIO layer to mostly benefit readline processing | |
| TextIOBase | back to summary |
|---|---|
| public TextIOBase(BufferedIOBase bufferedIO) Contruct a TextIOBase wrapping the given BufferedIOBase.
| |
| asInputStream | back to summary |
|---|---|
| public InputStream asInputStream() Overrides org. Doc from org. Coerce this into an InputStream if possible, or return null.
| |
| asOutputStream | back to summary |
|---|---|
| public OutputStream asOutputStream() Overrides org. Doc from org. Coerce this into an OutputStream if possible, or return null.
| |
| atEOF | back to summary |
|---|---|
| protected boolean atEOF() Return true if the file pointer is currently at EOF. If the file pointer is not at EOF, the readahead will contain at least one byte after this method is called.
| |
| clearReadahead | back to summary |
|---|---|
| protected void clearReadahead() Clear and reset the readahead buffer. | |
| close | back to summary |
|---|---|
| public void close() Overrides org. Doc from org. Flushes and closes the IO object. This must be idempotent. It should also set a flag for the 'closed' property (see below) to test.
| |
| closed | back to summary |
|---|---|
| public boolean closed() Overrides org. Doc from org. Return whether this file has been closed.
| |
| drainBuilder | back to summary |
|---|---|
| protected String drainBuilder() Return the String result of the builder, and reset it/perform cleanup on it.
| |
| fileno | back to summary |
|---|---|
| public RawIOBase fileno() Overrides org. Doc from org. Returns underlying file descriptor if one exists. Raises IOError if the IO object does not use a file descriptor. | |
| flush | back to summary |
|---|---|
| public void flush() Overrides org. Doc from org. Flushes write buffers, if applicable. This is a no-op for read-only and non-blocking streams.
| |
| getNewlines | back to summary |
|---|---|
| public PyObject getNewlines() Return the known Newline types, as a PyObject, encountered while reading this file. Returns None for all modes except universal newline mode.
| |
| isatty | back to summary |
|---|---|
| public boolean isatty() Overrides org. Doc from org. Returns whether this is an 'interactive' stream. Returns False if we don't know.
| |
| packReadahead | back to summary |
|---|---|
| protected void packReadahead() Restore the readahead to its original size (CHUNK_SIZE) if it was previously resized. The readahead contents are preserved. This method assumes it contains a number of remaining elements less than or equal to CHUNK_SIZE. | |
| read | back to summary |
|---|---|
| public String read(int size) Read and return up to size bytes, contained in a String. Returns an empty String on EOF
| |
| readable | back to summary |
|---|---|
| public boolean readable() Overrides org. Doc from org. Return whether this file was opened for reading.
| |
| readall | back to summary |
|---|---|
| public String readall() Read until EOF.
| |
| readChunk | back to summary |
|---|---|
| protected int readChunk() Read a chunk of data of size CHUNK_SIZE into the readahead buffer. Returns the amount of data read.
| |
| readChunk | back to summary |
|---|---|
| protected int readChunk(int size) Read a chunk of data of the given size into the readahead buffer. Returns the amount of data read. Enforces a minimum size of CHUNK_SIZE.
| |
| readinto | back to summary |
|---|---|
| public int readinto(PyObject buf) Read into the given PyObject that implements the Jython buffer API (with write access) or is a PyArray.
| |
| readline | back to summary |
|---|---|
| public String readline(int size) Read until size, newline or EOF. Returns an empty string if EOF is hit immediately.
| |
| seek | back to summary | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public long seek(long pos, int whence) Overrides org. Doc from org. Seek to byte offset
a long position value seeked to | |||||||||||||
| tell | back to summary |
|---|---|
| public long tell() Overrides org. Doc from org. Return the current stream position.
| |
| truncate | back to summary |
|---|---|
| public long truncate(long pos) Overrides org. Doc from org. Truncate file to size in bytes. Returns the new size.
| |
| writable | back to summary |
|---|---|
| public boolean writable() Overrides org. Doc from org. Return whether this file was opened for writing.
| |
| write | back to summary |
|---|---|
| public int write(String buf) Write the given String to the IO stream. Returns the number of characters written.
| |