Binary Streams: InputStream and OutputStream

InputStream is the analog of Reader; OutputStream is the analog of Writer. Their methods are listed here.


  • 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)


  • close()

  • flush() ...

Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.