Basic HTML version of Foils prepared Sept 21 1998

Foil 28 I/O Streams

From Java Tutorial 98- 4: Multi-Treading, Useful Java Classes, I/O and Networking NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

Java I/O stream constructors for Foil 28
A stream is a sequence of bytes or characters.
Stream sources and sinks include:
  • files
  • network connections
  • blocks of memory
  • threads
That is, all types of streams are treated similarly.
The most basic byte streams are InputStream and OutputStream. These classes have methods that can read or write a byte from or to a stream:
  • int read();
  • void write( int );
  • skip( long ); available(); flush(); close();
All of the above methods throw a possible IOException.
The read() and write( int ) methods "block" during 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 Sat Nov 28 1998