Basic HTML version of Foils prepared 18 May 97

Foil 25 I/O Streams

From Java Tutorial - Spring 1997 Part 4: Multithreading, useful Java classes, I/O, Networking, and the future Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


Streams are an abstraction of a sequence of bytes.
The sources and destinations of these sequences can be
  • files
  • network connections
  • blocks of memory
That is, all of these types of I/O are treated in the same way.
The most basic I/O streams are InputStream and OutputStream. These classes have methods that can read or write a byte from the stream:
  • int read ();
  • void write (byte);
  • also skip(), available(), close()
There are also methods for reading and writing arrays of bytes.
These methods all "block" on the read or write during the data transfer.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998