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

public Class BufferedWriter

extends BufferedIOMixin
Class Inheritance
Known Direct Subclasses
org.python.core.io.LineBufferedWriter
Imports
java.nio.ByteBuffer

Buffer for a writable sequential RawIO object.
Author
Philip Jenvey

Field Summary

Modifier and TypeField and Description
protected ByteBuffer
buffer

The underlying buffer

Inherited from org.python.core.io.BufferedIOMixin:
bufferSizerawIO

Constructor Summary

AccessConstructor and Description
public
BufferedWriter(RawIOBase rawIO, int bufferSize)

Construct a BufferedWriter of bufferSize, wrapping the given RawIOBase.

Method Summary

Modifier and TypeMethod and Description
public boolean
buffered()

Overrides org.python.core.io.BufferedIOBase.buffered.

Return true if this objects buffer contains any data.

public void
flush()

Overrides org.python.core.io.BufferedIOMixin.flush.

Flushes write buffers, if applicable.

public int
read1(ByteBuffer
a ByteBuffer to read bytes into
bytes
)

Overrides org.python.core.io.BufferedIOBase.read1.

Reads up to bytes.remaining() bytes.

public boolean
readable()

Overrides org.python.core.io.BufferedIOMixin.readable.

Return whether this file was opened for reading.

public ByteBuffer
public int
readinto(ByteBuffer
a ByteBuffer to read bytes into
bytes
)

Overrides org.python.core.io.BufferedIOBase.readinto.

Read up to bytes.remaining() bytes into the given ByteBuffer.

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

Overrides org.python.core.io.BufferedIOMixin.seek.

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

public long
tell()

Overrides org.python.core.io.BufferedIOMixin.tell.

Return the current stream position.

public int
write(ByteBuffer
a ByteBuffer value
bytes
)

Overrides org.python.core.io.BufferedIOBase.write.

Write the given ByteBuffer to the IO stream.

Inherited from org.python.core.io.BufferedIOMixin:
asInputStreamasOutputStreamcloseclosedfilenoisattytruncatewritable

Field Detail

bufferback to summary
protected ByteBuffer buffer

The underlying buffer

Constructor Detail

BufferedWriterback to summary
public BufferedWriter(RawIOBase rawIO, int bufferSize)

Construct a BufferedWriter of bufferSize, wrapping the given RawIOBase.

Method Detail

bufferedback to summary
public boolean buffered()

Overrides org.python.core.io.BufferedIOBase.buffered.

Doc from org.python.core.io.BufferedIOBase.buffered.

Return true if this objects buffer contains any data.

Returns:boolean

boolean whether or not any data is currently buffered

Annotations
@Override

flushback to summary
public void flush()

Overrides org.python.core.io.BufferedIOMixin.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
read1back to summary
public int read1(ByteBuffer bytes)

Overrides org.python.core.io.BufferedIOBase.read1.

Doc from org.python.core.io.BufferedIOBase.read1.

Reads up to bytes.remaining() bytes. Returns up to bytes.remaining() bytes. If at least one byte is buffered, we only return buffered bytes. Otherwise, we do one raw read.

Parameters
bytes:ByteBuffer

a ByteBuffer to read bytes into

Returns:int

the amount of data read as an int

Annotations
@Override

readableback to summary
public boolean readable()

Overrides org.python.core.io.BufferedIOMixin.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

readallback to summary
public ByteBuffer readall()

Overrides org.python.core.io.BufferedIOBase.readall.

Doc from org.python.core.io.BufferedIOBase.readall.

Read until EOF.

Returns:ByteBuffer

a ByteBuffer containing the bytes read

Annotations
@Override

readintoback to summary
public int readinto(ByteBuffer bytes)

Overrides org.python.core.io.BufferedIOBase.readinto.

Doc from org.python.core.io.BufferedIOBase.readinto.

Read up to bytes.remaining() bytes into the given ByteBuffer. Returns number of bytes read (0 for EOF).

Parameters
bytes:ByteBuffer

a ByteBuffer to read bytes into

Returns:int

the amount of data read as an int

Annotations
@Override

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

Overrides org.python.core.io.BufferedIOMixin.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.BufferedIOMixin.tell.

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

Return the current stream position.

Returns:long

a long position value

Annotations
@Override

writeback to summary
public int write(ByteBuffer bytes)

Overrides org.python.core.io.BufferedIOBase.write.

Doc from org.python.core.io.BufferedIOBase.write.

Write the given ByteBuffer to the IO stream. Returns the number of bytes written, which may be less than bytes.remaining().

Parameters
bytes:ByteBuffer

a ByteBuffer value

Returns:int

the number of bytes written as an int

Annotations
@Override