## org.python.core.io
Class BufferedIOMixin

    java.lang.Object
      org.python.core.io.IOBase
          org.python.core.io.BufferedIOBase
              org.python.core.io.BufferedIOMixin

Direct Known Subclasses:
  BufferedRandom, BufferedReader, BufferedWriter

    public abstract class BufferedIOMixin

extends BufferedIOBase

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

Fields inherited from class org.python.core.io.IOBase
`DEFAULT_BUFFER_SIZE`

Constructor Summary
`BufferedIOMixin(RawIOBase rawIO)` Initialize this buffer, wrapping the given RawIOBase.
`BufferedIOMixin(RawIOBase rawIO, int bufferSize)` Initialize this buffer, wrapping the given RawIOBase.

Method Summary
`InputStream` `asInputStream()` Coerce this into an InputStream if possible, or return null.
`OutputStream` `asOutputStream()` Coerce this into an OutputStream if possible, or return null.
`void` `close()` Flushes and closes the IO object.
`boolean` `closed()` Return whether this file has been closed.
`RawIOBase` `fileno()` Returns underlying file descriptor if one exists.
`void` `flush()` Flushes write buffers, if applicable.
`boolean` `isatty()` Returns whether this is an 'interactive' stream.
`boolean` `readable()` Return whether this file was opened for reading.
`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.
`long` `truncate(long size)` Truncate file to size in bytes.
`boolean` `writable()` Return whether this file was opened for writing.

Methods inherited from class org.python.core.io.BufferedIOBase
`buffered, clear, peek, read, read1, readall, readinto, write`

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

### BufferedIOMixin

    public BufferedIOMixin(RawIOBase rawIO)

  Initialize this buffer, wrapping the given RawIOBase.

  Parameters:
    `rawIO` - a RawIOBase to wrap

### BufferedIOMixin

    public BufferedIOMixin(RawIOBase rawIO,
                           int bufferSize)

  Initialize this buffer, wrapping the given RawIOBase.

  Parameters:
    `rawIO` - a RawIOBase to wrap
    `bufferSize` - the size of the buffer

Method Detail

### 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 `IOBase`
  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 `IOBase`
  Returns:
    a long position value

### truncate

    public long truncate(long size)

  Description copied from class: `IOBase`
  Truncate file to size in bytes. Returns the new size.

  Overrides:
    `truncate` in class `IOBase`
  Parameters:
    `size` - a long size to truncate to
  Returns:
    a long size value the file was truncated to

### flush

    public void flush()

  Description copied from class: `IOBase`
  Flushes write buffers, if applicable. This is a no-op for read-only and non-blocking streams.

  Overrides:
    `flush` in class `IOBase`

### close

    public void close()

  Description copied from class: `IOBase`
  Flushes and closes the IO object. This must be idempotent. It should also set a flag for the 'closed' property (see below) to test.

  Overrides:
    `close` in class `IOBase`

### fileno

    public RawIOBase fileno()

  Description copied from class: `IOBase`
  Returns underlying file descriptor if one exists. Raises IOError if the IO object does not use a file descriptor.

  Overrides:
    `fileno` in class `IOBase`
  Returns:
    a file descriptor

### isatty

    public boolean isatty()

  Description copied from class: `IOBase`
  Returns whether this is an 'interactive' stream. Returns False if we don't know.

  Overrides:
    `isatty` in class `IOBase`
  Returns:
    a boolean, true if an 'interactive' stream

### readable

    public boolean readable()

  Description copied from class: `IOBase`
  Return whether this file was opened for reading.

  Overrides:
    `readable` in class `IOBase`
  Returns:
    true if the file was opened for reading

### writable

    public boolean writable()

  Description copied from class: `IOBase`
  Return whether this file was opened for writing.

  Overrides:
    `writable` in class `IOBase`
  Returns:
    true if the file was opened for writing

### closed

    public boolean closed()

  Description copied from class: `IOBase`
  Return whether this file has been closed.

  Overrides:
    `closed` in class `IOBase`
  Returns:
    true if the file has been closed

### asInputStream

    public InputStream asInputStream()

  Description copied from class: `IOBase`
  Coerce this into an InputStream if possible, or return null.

  Overrides:
    `asInputStream` in class `IOBase`

### asOutputStream

    public OutputStream asOutputStream()

  Description copied from class: `IOBase`
  Coerce this into an OutputStream if possible, or return null.

  Overrides:
    `asOutputStream` in class `IOBase`

Jython homepage