




































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





































ļ Use JFileChooser
Program
Output Stream
File
Input Stream
InputStream
OutputStream
RandomAccessFile
Object
PipeOutputStream
SequenceInputStream
StringBufferInputStream ByteArrayOutputStream
ObjectOutputStream
FilterOutputStream
FileOutputStream
PipedInputStream
PushBackInputStream
BufferedInputStream LineNumberInputStream
DataInputStream
BufferedOutputStream DataOutputStream PrintStream
ObjectInputStream
FilterInputStream
FileInputStream
ByteArrayInputStream (^) InputData
OutputData
ObjectOutput
ObjectInput
Reader
Writer
StreamTokenizer
Object
PrintWriter
BufferedWriter CharArrayWriter
PipedWriter
FilterWriter
PipedReader LineNumberReader
FileReader PushBackReader
FileWriter
StringWriter
StringReader
InputStreamReader
CharArrayReader
BufferedReader
FilterReader
OutputStreamWriter
Reader
The Reader class is similar to the InputStream class. The methods in Reader are subject to character interpretation.
abstract int read() throws IOException int read(char b[]) throws IOException void close() throws IOException long skip(long n) throws IOException
Note that if no data are available, it blocks the thread from executing next statement.
OutputStream
Constructing instances of FileInputStream, FileOutputStream, FileReader, and FileWriter from file names:
FileInputStream infile = new FileInputStream("in.dat");
FileOutputStream outfile = new FileOutputStream("out.dat");
FileReader infile = new FileReader("in.dat");
FileWriter outfile = new FileWriter("out.dat"); Docsity.com
The data streams ( DataInputStream and DataOutputStream) read and write Java primitive types in a machine-independent fashion, which enables you to write a data file in one machine and read it on another machine that has a different operating system or file structure.
DataInputStream Methods
TestDataStreams
Run
Click the Run button to access the DOS prompt; then type java TestDataStreams and press Enter. (Note: You cannot run this from the CD; the program writes to disk.)
DataInputStream dis
program mytemp.dat
mytemp.dat
DataOutputStream dos
FileInputStream
FileOutputStream