Package org.python.core.io
Class UniversalIOWrapper
java.lang.Object
org.python.core.io.IOBase
org.python.core.io.TextIOBase
org.python.core.io.UniversalIOWrapper
A Buffered text stream in universal newlines mode.
- Author:
- Philip Jenvey
-
Field Summary
Fields inherited from class org.python.core.io.TextIOBase
CHUNK_SIZEFields inherited from class org.python.core.io.IOBase
DEFAULT_BUFFER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionUniversalIOWrapper(BufferedIOBase bufferedIO) Contruct a UniversalIOWrapper wrapping the given BufferedIOBase. -
Method Summary
Modifier and TypeMethodDescriptionReturn the known Newline types, as a PyObject, encountered while reading this file.read(int size) Read and return up to size bytes, contained in a String.readall()Read until EOF.readline(int size) Read until size, newline or EOF.longseek(long pos, int whence) Seek to byte offsetposrelative to position indicated bywhence.longtell()Return the current stream position.intWrite 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, writableMethods inherited from class org.python.core.io.IOBase
checkClosed, checkReadable, checkWritable, seek
-
Constructor Details
-
UniversalIOWrapper
Contruct a UniversalIOWrapper wrapping the given BufferedIOBase.- Parameters:
bufferedIO-
-
-
Method Details
-
read
Description copied from class:TextIOBaseRead and return up to size bytes, contained in a String. Returns an empty String on EOF- Overrides:
readin classTextIOBase- Parameters:
size- the number of bytes to read- Returns:
- a String containing the bytes read
-
readall
Description copied from class:TextIOBaseRead until EOF.- Overrides:
readallin classTextIOBase- Returns:
- a String containing the bytes read
-
readline
Description copied from class:TextIOBaseRead until size, newline or EOF. Returns an empty string if EOF is hit immediately.- Overrides:
readlinein classTextIOBase- Parameters:
size- the number of bytes to read- Returns:
- a String containing the bytes read
-
write
Description copied from class:TextIOBaseWrite the given String to the IO stream. Returns the number of characters written.- Overrides:
writein classTextIOBase- 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:IOBaseSeek to byte offsetposrelative to position indicated bywhence.
Returns the new absolute position.Semantics whenceSeek to pos0 Start of stream (the default). Should be ≥0. 1 Current position + posEither sign. 2 End of stream + posUsually ≤0. - Overrides:
seekin classTextIOBase- Parameters:
pos- a long position valuewhence- an int whence value- Returns:
- a long position value seeked to
-
tell
public long tell()Description copied from class:IOBaseReturn the current stream position.- Overrides:
tellin classTextIOBase- Returns:
- a long position value
-
getNewlines
Description copied from class:TextIOBaseReturn the known Newline types, as a PyObject, encountered while reading this file. Returns None for all modes except universal newline mode.- Overrides:
getNewlinesin classTextIOBase- Returns:
- a PyObject containing all encountered Newlines, or None
-