Top Description Fields Constructors Methods
org.python.core.io

public abstract Class BufferedIOMixin

extends BufferedIOBase
Class Inheritance
Known Direct Subclasses
org.python.core.io.BufferedRandom, org.python.core.io.BufferedReader, org.python.core.io.BufferedWriter
Imports
java.io.InputStream, .OutputStream, org.python.core.Py, .PyException

A mixin implementation of BufferedIOBase with an underlying raw stream. This passes most requests on to the underlying raw stream. It does *not* provide implementations of read(), readinto() or write().
Author
Philip Jenvey

Field Summary

Modifier and TypeField and Description
protected int
bufferSize

The size of the buffer

protected RawIOBase
rawIO

The underlying raw io stream

Constructor Summary

AccessConstructor and Description
public
BufferedIOMixin(RawIOBase
a RawIOBase to wrap
rawIO
)

Initialize this buffer, wrapping the given RawIOBase.

public
BufferedIOMixin(RawIOBase
a RawIOBase to wrap
rawIO
,
int
the size of the buffer
bufferSize
)

Initialize this buffer, wrapping the given RawIOBase.

Method Summary

Modifier and TypeMethod and Description
public InputStream
asInputStream()

Overrides org.python.core.io.IOBase.asInputStream.

Coerce this into an InputStream if possible, or return null.

public OutputStream
asOutputStream()

Overrides org.python.core.io.IOBase.asOutputStream.

Coerce this into an OutputStream if possible, or return null.

public void
close()

Overrides org.python.core.io.IOBase.close.

Flushes and closes the IO object.

public boolean
closed()

Overrides org.python.core.io.IOBase.closed.

Return whether this file has been closed.

public RawIOBase
fileno()

Overrides org.python.core.io.IOBase.fileno.

Returns underlying file descriptor if one exists.

public void
flush()

Overrides org.python.core.io.IOBase.flush.

Flushes write buffers, if applicable.

public boolean
isatty()

Overrides org.python.core.io.IOBase.isatty.

Returns whether this is an 'interactive' stream.

public boolean
readable()

Overrides org.python.core.io.IOBase.readable.

Return whether this file was opened for reading.

public long
seek(long
a long position value
pos
,
int
an int whence value
whence
)

Overrides org.python.core.io.IOBase.seek.

Seek to byte offset pos relative to position indicated by whence.

public long
tell()

Overrides org.python.core.io.IOBase.tell.

Return the current stream position.

public long
truncate(long
a long size to truncate to
size
)

Overrides org.python.core.io.IOBase.truncate.

Truncate file to size in bytes.

public boolean
writable()

Overrides org.python.core.io.IOBase.writable.

Return whether this file was opened for writing.

Inherited from org.python.core.io.BufferedIOBase:
bufferedclearpeekreadread1readallreadintoreadintowrite

Field Detail

bufferSizeback to summary
protected int bufferSize

The size of the buffer

rawIOback to summary
protected RawIOBase rawIO

The underlying raw io stream

Constructor Detail

BufferedIOMixinback to summary
public BufferedIOMixin(RawIOBase rawIO)

Initialize this buffer, wrapping the given RawIOBase.

Parameters
rawIO:RawIOBase

a RawIOBase to wrap

BufferedIOMixinback to summary
public BufferedIOMixin(RawIOBase rawIO, int bufferSize)

Initialize this buffer, wrapping the given RawIOBase.

Parameters
rawIO:RawIOBase

a RawIOBase to wrap

bufferSize:int

the size of the buffer

Method Detail

asInputStreamback to summary
public InputStream asInputStream()

Overrides org.python.core.io.IOBase.asInputStream.

Doc from org.python.core.io.IOBase.asInputStream.

Coerce this into an InputStream if possible, or return null.

Annotations
@Override
asOutputStreamback to summary
public OutputStream asOutputStream()

Overrides org.python.core.io.IOBase.asOutputStream.

Doc from org.python.core.io.IOBase.asOutputStream.

Coerce this into an OutputStream if possible, or return null.

Annotations
@Override
closeback to summary
public void close()

Overrides org.python.core.io.IOBase.close.

Doc from org.python.core.io.IOBase.close.

Flushes and closes the IO object. This must be idempotent. It should also set a flag for the 'closed' property (see below) to test.

Annotations
@Override
closedback to summary
public boolean closed()

Overrides org.python.core.io.IOBase.closed.

Doc from org.python.core.io.IOBase.closed.

Return whether this file has been closed.

Returns:boolean

true if the file has been closed

Annotations
@Override

filenoback to summary
public RawIOBase fileno()

Overrides org.python.core.io.IOBase.fileno.

Doc from org.python.core.io.IOBase.fileno.

Returns underlying file descriptor if one exists. Raises IOError if the IO object does not use a file descriptor.

Returns:RawIOBase

a file descriptor

Annotations
@Override

flushback to summary
public void flush()

Overrides org.python.core.io.IOBase.flush.

Doc from org.python.core.io.IOBase.flush.

Flushes write buffers, if applicable. This is a no-op for read-only and non-blocking streams.

Annotations
@Override
isattyback to summary
public boolean isatty()

Overrides org.python.core.io.IOBase.isatty.

Doc from org.python.core.io.IOBase.isatty.

Returns whether this is an 'interactive' stream. Returns False if we don't know.

Returns:boolean

a boolean, true if an 'interactive' stream

Annotations
@Override

readableback to summary
public boolean readable()

Overrides org.python.core.io.IOBase.readable.

Doc from org.python.core.io.IOBase.readable.

Return whether this file was opened for reading.

Returns:boolean

true if the file was opened for reading

Annotations
@Override

seekback to summary
public long seek(long pos, int whence)

Overrides org.python.core.io.IOBase.seek.

Doc from org.python.core.io.IOBase.seek.

Seek to byte offset pos relative to position indicated by whence.

Semantics
whence Seek to pos
0 Start of stream (the default).Should be ≥0.
1 Current position + pos Either sign.
2 End of stream + pos Usually ≤0.
Returns the new absolute position.
Parameters
pos:long

a long position value

whence:int

an int whence value

Returns:long

a long position value seeked to

Annotations
@Override

tellback to summary
public long tell()

Overrides org.python.core.io.IOBase.tell.

Doc from org.python.core.io.IOBase.tell.

Return the current stream position.

Returns:long

a long position value

Annotations
@Override

truncateback to summary
public long truncate(long size)

Overrides org.python.core.io.IOBase.truncate.

Doc from org.python.core.io.IOBase.truncate.

Truncate file to size in bytes. Returns the new size.

Parameters
size:long

a long size to truncate to

Returns:long

a long size value the file was truncated to

Annotations
@Override

writableback to summary
public boolean writable()

Overrides org.python.core.io.IOBase.writable.

Doc from org.python.core.io.IOBase.writable.

Return whether this file was opened for writing.

Returns:boolean

true if the file was opened for writing

Annotations
@Override