Basic HTML version of Foils prepared May 12 1996

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

From CRPC Lectures on Java Language Applets Graphics CRPC Annual Meeting Tutorial -- May 14,1996. by Geoffrey C. Fox


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 Sun Dec 14 1997