Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython
by Richard Hightower
Binary Streams: InputStream and OutputStream
InputStream is the analog of Reader; OutputStream is the analog of Writer. Their methods are listed here.
InputStream:
read(byte_sequence)— reads a sequence of bytes and returns the actual bytes read
read(byte_sequence, off, len)— same as above but allows you to set the slice for the sequence; returns the number of actual bytes read
read()— reads one byte of data from the input stream
skip(n)— skips to a given offset in the file
close()— closes the stream
reset()— moves the file pointer to the marked position
mark(iReadlimit)— marks the file pointer
available()— returns the number of bytes available that can be read without blocking (similar to the Reader class's ready() method)
OutputStream:
close()
flush() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access