Back to the main page
Resources
Input/OutputStreams are concerned with bytes
- InputStream <<Closeable>> read() close()
- ByteArrayInputStream (byte[] buffer)
- FileInputStream (File) (String filename)
- FilterInputStream (InputStream)
- BufferedInputStream
- DataInputStream<<DataInput>> readBoolean() readUTF()
- ObjectInputStream <<ObjectInput>> readObject()
- OutputStream <<Closeable, Flushable>> write() flush() close()
- ByteArrayOutputStream (byte[] buffer)
- FileOutputStream (File) (String filename)
- FilterOutputStream (OutputStream)
- BufferedOutputStream
- DataOutputStream<<DataOutput>> writeBoolean() writeUTF()
- ObjectOutputStream <<ObjectOutput>> writeObject()
Readers/Writers are concerned with characters
- Reader <<Closeable, Readable>> read() close()
- BufferedReader (Reader) readline()
- InputStreamReader (InputStream)
- FileReader (File) (String filename)
- Writer <<Closeable, Flushable, Appendable>> write() append() close()
- BufferedWriter (Writer)
- OutputStreamWriter (OutputStream)
- FileWriter (File) (String filename)
- PrintWriter (ObjectStream) (File) (String filename) (Writer) print() printf()
Key Exception classes
- java.lang.Throwable
- java.lang.Error
- java.lang.Exception
- java.io.IOException
- java.io.EOFException
- java.io.FileNotFoundException
- java.io.InterruptedIOException
- java.io.ObjectStreamException
Typical usage
- new BufferedReader(new FileReader("input.txt")).readLine();
- new PrintWriter(new FileWriter("output.txt")).println(string);