Java IO

less than 1 minute read

Class with InputStream or OutputStream (in its name) -> for BinaryData

Class with Reader and Writer (in its name) -> for char or String data

A low level stream connects directly with the source of data

A high level stream is built on top of another stream using wrapping

A class with Buffered in its name reads or writes data in groups of bytes or characters. improves performance in sequential file syatems

COMMON STREAM OPERATIONS

Closing the stream : calling the close() in finally or using the try-with-resource syntax

Flushing the Stream : call after reasonable amount of writes

Marking the Stream : mark(int) and reset methods to move the stream back to an earlier position. markSupported() returns true only if mark() is supported

Skipping over data : skip(long) skips over a certain number of bytes

Tags:

Categories:

Updated: