public class FileIO extends RawIOBase
DEFAULT_BUFFER_SIZE| Constructor and Description |
|---|
FileIO(java.nio.channels.FileChannel fileChannel,
java.lang.String mode)
Construct a FileIO instance with the given FileChannel.
|
FileIO(PyString name,
java.lang.String mode)
Construct a FileIO instance for the specified file name, which will be decoded using the
nominal Jython file system encoding if it is a
str/bytes rather than a
unicode. |
FileIO(java.lang.String name,
java.lang.String mode) |
| Modifier and Type | Method and Description |
|---|---|
PyObject |
__add__(PyObject otherObj) |
PyObject |
__int__() |
java.io.InputStream |
asInputStream()
Coerce this into an InputStream if possible, or return null.
|
java.io.OutputStream |
asOutputStream()
Coerce this into an OutputStream if possible, or return null.
|
void |
close()
Flushes and closes the IO object.
|
java.nio.channels.FileChannel |
getChannel()
Return the underlying Java nio Channel.
|
java.io.FileDescriptor |
getFD() |
boolean |
isatty()
Returns whether this is an 'interactive' stream.
|
boolean |
readable()
Return whether this file was opened for reading.
|
java.nio.ByteBuffer |
readall()
Read until EOF with one readinto() call.
|
int |
readinto(java.nio.ByteBuffer buf)
Read up to buf.remaining() bytes into buf.
|
long |
readinto(java.nio.ByteBuffer[] bufs)
Read bytes into each of the specified ByteBuffers via scatter i/o.
|
long |
seek(long pos,
int whence)
Seek to byte offset
pos relative to position indicated by whence. |
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.
|
int |
write(java.nio.ByteBuffer buf)
Write the given ByteBuffer to the IO stream.
|
long |
write(java.nio.ByteBuffer[] bufs)
Write bytes from each of the specified ByteBuffers via gather
i/o.
|
checkClosed, checkReadable, checkWritable, closed, flush, seekpublic FileIO(java.lang.String name,
java.lang.String mode)
FileIO(PyString name, String mode)public FileIO(PyString name, java.lang.String mode)
str/bytes rather than a
unicode.
The mode can be 'r', 'w' or 'a' for reading (default), writing or appending. Add a '+' to the
mode to allow simultaneous reading and writing.name - the name of the filemode - a raw io file mode Stringpublic FileIO(java.nio.channels.FileChannel fileChannel,
java.lang.String mode)
fileChannel - a FileChannel objectmode - a raw io file mode Stringpublic boolean isatty()
IOBasepublic int readinto(java.nio.ByteBuffer buf)
RawIOBasepublic long readinto(java.nio.ByteBuffer[] bufs)
public java.nio.ByteBuffer readall()
public int write(java.nio.ByteBuffer buf)
RawIOBasepublic long write(java.nio.ByteBuffer[] bufs)
public long seek(long pos,
int whence)
IOBasepos relative to position indicated by whence.
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. |
public long tell()
IOBasepublic long truncate(long size)
IOBasepublic void close()
IOBasepublic java.io.OutputStream asOutputStream()
IOBaseasOutputStream in class IOBasepublic java.io.InputStream asInputStream()
IOBaseasInputStream in class IOBasepublic boolean readable()
IOBasepublic boolean writable()
IOBasepublic java.nio.channels.FileChannel getChannel()
RawIOBasegetChannel in class RawIOBasepublic java.io.FileDescriptor getFD()
public PyObject __int__()