UniversalIOWrapper (Jython API documentation)
Date: 2015-04-29

org.python.core.io

## Class UniversalIOWrapper

- java.lang.Object
- - org.python.core.io.IOBase
  - - org.python.core.io.TextIOBase
    - - org.python.core.io.UniversalIOWrapper

-     public class UniversalIOWrapper
      extends TextIOBase

  A Buffered text stream in universal newlines mode.
  Author:
    Philip Jenvey

- - ### 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
    `UniversalIOWrapper(BufferedIOBase bufferedIO)` Contruct a UniversalIOWrapper wrapping the given BufferedIOBase.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PyObject` | `getNewlines()` Return the known Newline types, as a PyObject, encountered while reading this file.
    `String` | `read(int size)` Read and return up to size bytes, contained in a String.
    `String` | `readall()` Read until EOF.
    `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.
    `int` | `write(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, isatty, readable, readinto, 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

    - #### UniversalIOWrapper

          public UniversalIOWrapper(BufferedIOBase bufferedIO)

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

  - ### Method Detail

    - #### read

          public 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 `TextIOBase`
      Parameters:
        `size` - the number of bytes to read
      Returns:
        a String containing the bytes read

    - #### readall

          public String readall()

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

    - #### readline

          public 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 `TextIOBase`
      Parameters:
        `size` - the number of bytes to read
      Returns:
        a String containing the bytes read

    - #### write

          public int write(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 `TextIOBase`
      Parameters:
        `buf` - a String value
      Returns:
        the number of characters written as an int

    - #### seek

          public long seek(long pos,
                  int whence)

      Description copied from class: `IOBase`
      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. Returns the new absolute position.
      Overrides:
        `seek` in class `TextIOBase`
      Parameters:
        `pos` - a long position value
        `whence` - an int whence value
      Returns:
        a long position value seeked to

    - #### tell

          public long tell()

      Description copied from class: `IOBase`
      Return the current stream position.
      Overrides:
        `tell` in class `TextIOBase`
      Returns:
        a long position value

    - #### getNewlines

          public PyObject getNewlines()

      Description copied from class: `TextIOBase`
      Return the known Newline types, as a PyObject, encountered while reading this file. Returns None for all modes except universal newline mode.
      Overrides:
        `getNewlines` in class `TextIOBase`
      Returns:
        a PyObject containing all encountered Newlines, or None

Jython homepage