22
C H A P T E R
The Package
java.io
I
NPUT and output in Jav
The P
a is or
ackage java.io
ganized around the concept of streams. A stream
is a sequence of items, usually 8 bit bytes, read or written over the course of time.
In the
java.io
 package, all input is done through subclasses of the abstract
class
InputStream
, and all output is done through subclasses of the abstract class
OutputStream
. The one exception to this rule is the class
RandomAccessFile
,
which handles files that allow random access and perhaps intermixed reading and
writing of the file.
For an input stream, the source of data might be a file, a
String
, an array of
bytes, or bytes written to an output stream (typically by another thread). There are
also  filter input streams  that take data from another input stream and transform
or augment the data before delivering it as input. For example, a
LineNumberInputStream
passes bytes through verbatim but counts line termina 
tors as they are read.
For an output stream, the sink of data might be a file, an array of bytes, or a
buffer to be read as an input stream (typically by another thread). There are also
 filter output streams  that transform or augment data before writing it to some
other output stream.
An instance of class
File
 represents a path name (a string) that might identify
a particular file within a file system. Certain operations on the file system, such as
renaming and deleting files, are done by this class rather than through streams.
An instance of class
FileDescriptor
 represents an abstract indication of a
particular file within a file system; such file descriptors are created internally by
the Java I/O system.
There are two interfaces,
DataInput
 and
DataOutput
, that support the trans 
fer of data other than bytes or characters, such as long integers, floating point
numbers and strings. The class
DataInputStream
 implements
DataInput
; the
class
DataOutputStream
 implements
DataOutput
; and
RandomAccessFile
implements both
DataInput
 and
DataOutput
.
The class
StreamTokenizer
 provides some simple support for parsing bytes
or characters from an input stream into tokens such as identifiers, numbers, and
665






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved