HELP! * GREY=local LOCAL HTML version of Foils prepared 29 January 1996

Foil 111 Input/Output in Java -- InputStreams -- I

From CPS616 Lectures on Java CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. by Geoffrey C. Fox * See also color IMAGE

In java.io, there are several classes that throw IOExceptions -- please catch them!
The class InputStream is basic and it has methods such as read() skip() (bytes in a stream) available() (bytes remaining in stream) close().
InputStreams can be created from memory
inputStream s = new ByteArrayInputStream(buffer, 100, 300); // creates a stream of 300 bytes in locations 100 to 399
More usefully, they can be created from a UNIX file
inputStream s = new FileInputStream("/usr/gcf/greatidea");



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 Tue Feb 18 1997