FileReader

class hdfs_native.FileReader(inner: RawFileReader)

Bases: RawIOBase

Attributes Summary

size

Methods Summary

close()

Flush and close the IO object.

read([size])

Read up to size bytes from the file, or all content if -1

read_range(offset, len)

Read len bytes from the file starting at offset.

readable()

Return whether object was opened for reading.

readall()

Read until EOF, using multiple read() call.

seek(offset[, whence])

Seek to offset relative to whence

seekable()

Return whether object supports random access.

tell()

Return current stream position.

Attributes Documentation

size

Methods Documentation

close() None

Flush and close the IO object.

This method has no effect if the file is already closed.

read(size: int = -1) bytes

Read up to size bytes from the file, or all content if -1

read_range(offset: int, len: int) bytes

Read len bytes from the file starting at offset. Doesn’t affect the position in the file

readable() bool

Return whether object was opened for reading.

If False, read() will raise OSError.

readall() bytes

Read until EOF, using multiple read() call.

seek(offset: int, whence=0)

Seek to offset relative to whence

seekable()

Return whether object supports random access.

If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().

tell() int

Return current stream position.