TextIOWrapper (Jython API documentation)
Date: 2024-08-18

org.python.core.io

## Class TextIOWrapper

- java.lang.Object
- - org.python.core.io.IOBase
  - - org.python.core.io.TextIOBase
    - - org.python.core.io.BinaryIOWrapper
      - - org.python.core.io.TextIOWrapper

-     public class TextIOWrapper
      extends BinaryIOWrapper

  A Buffered text stream. This differs from py3k TextIOWrapper, which currently handles both text mode (py3k text mode is incompatible with Python 2.x's text mode) as well as universal mode.
  Author:
    Philip Jenvey
  See Also:
    `UniversalIOWrapper`

- - ### Field Summary

    - ### Fields inherited from class org.python.core.io.TextIOBase

      `CHUNK_SIZE`

    - ### Fields inherited from class org.python.core.io.IOBase

      `DEFAULT_BUFFER_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextIOWrapper(BufferedIOBase bufferedIO)` Contruct a TextIOWrapper wrapping the given BufferedIOBase.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `read(int size)` Read and return up to size bytes, contained in a String.
    `java.lang.String` | `readall()` Read until EOF.
    `java.lang.String` | `readline(int size)` Read until size, newline or EOF.
    `int` | `write(java.lang.String buf)` Write the given String to the IO stream.

    - ### Methods inherited from class org.python.core.io.TextIOBase

      `asInputStream, asOutputStream, close, closed, fileno, flush, getNewlines, isatty, readable, readinto, seek, tell, truncate, writable`

    - ### Methods inherited from class org.python.core.io.IOBase

      `checkClosed, checkReadable, checkWritable, seek`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TextIOWrapper

          public TextIOWrapper(BufferedIOBase bufferedIO)

      Contruct a TextIOWrapper wrapping the given BufferedIOBase.
      Parameters:
        `bufferedIO` -

  - ### Method Detail

    - #### read

          public java.lang.String read(int size)

      Description copied from class: `TextIOBase`
      Read and return up to size bytes, contained in a String. Returns an empty String on EOF
      Overrides:
        `read` in class `BinaryIOWrapper`
      Parameters:
        `size` - the number of bytes to read
      Returns:
        a String containing the bytes read

    - #### readall

          public java.lang.String readall()

      Description copied from class: `TextIOBase`
      Read until EOF.
      Overrides:
        `readall` in class `BinaryIOWrapper`
      Returns:
        a String containing the bytes read

    - #### readline

          public java.lang.String readline(int size)

      Description copied from class: `TextIOBase`
      Read until size, newline or EOF. Returns an empty string if EOF is hit immediately.
      Overrides:
        `readline` in class `BinaryIOWrapper`
      Parameters:
        `size` - the number of bytes to read
      Returns:
        a String containing the bytes read

    - #### write

          public int write(java.lang.String buf)

      Description copied from class: `TextIOBase`
      Write the given String to the IO stream. Returns the number of characters written.
      Overrides:
        `write` in class `BinaryIOWrapper`
      Parameters:
        `buf` - a String value
      Returns:
        the number of characters written as an int

Jython homepage