Java Streams  «Prev 

InputStream and OutputStream Subclasses

1) Sequence InputStream 2) Piped InputStream 3) Object InputStream 4) File InputStream 5) Filter InputStream 6) ByteArray InputStream
1) Sequence InputStream, 2) Piped InputStream, 3) Object InputStream, 4) File InputStream, 5) Filter InputStream, 6) ByteArray InputStream

1) Piped OutputStream 2) Object OutputStream 3) Filter OutputStream 4) File OutputStream 5) ByteArray OutputStream 6) Data OutputStream 7) PrintStream 8) Buffed OutputStream
1) Piped OutputStream, 2) Object OutputStream, 3) Filter OutputStream, 4) File OutputStream, 5) ByteArray OutputStream, 6) Data OutputStream, 7) PrintStream, 8) Buffed OutputStream

Byte streams are defined by using two class hierarchies. At the top are two abstract classes:
  1. InputStream and
  2. OutputStream.
Each of these abstract classes has several concrete subclasses that handle the differences among various devices, such as 1) disk files, 2) network connections, and 3) memory buffers.
public class PipedInputStream
extends InputStream

A piped input stream should be connected to a piped output stream; the piped input stream then provides whatever data bytes are written to the piped output stream. Typically, data is read from a PipedInputStream object by one thread and data is written to the corresponding PipedOutputStream by some other thread. Attempting to use both objects from a single thread is not recommended, as it may deadlock the thread. The piped input stream contains a buffer, decoupling read operations from write operations, within limits. A pipe is said to be broken if a thread that was providing data bytes to the connected piped output stream is no longer alive.

5 StandardOpenOption Enums from NIO 2

In java.nio.file.StandardOpenOption Enum, there are 10 standard open Options defined.
These options are objects that configure how to open or create a file.

OptionDescription
APPEND If this option is present then the file is opened for writing and each invocation of the channel's write method first advances the position to the end of the file and then writes the requested data. Whether the advancement of the position and the writing of the data are done in a single atomic operation is system-dependent and therefore unspecified. This option may not be used in conjunction with the READ or TRUNCATE_EXISTING options.
TRUNCATE_EXISTING If this option is present then the existing file is truncated to a size of 0 bytes. This option is ignored when the file is opened only for reading.
CREATE_NEW If this option is present then a new file is created, failing if the file already exists or is a symbolic link. When creating a file the check for the existence of the file and the creation of the file if it does not exist is atomic with respect to other file system operations. This option is ignored when the file is opened only for reading.
CREATE If this option is present then an existing file is opened if it exists, otherwise a new file is created.
This option is ignored if the CREATE_NEW option is also present or the file is opened only for reading.
DELETE_ON_CLOSE When this option is present then the implementation makes a best effort attempt to delete the file when closed by the close method. If the close method is not invoked then a best effort attempt is made to delete the file when the Java virtual machine terminates.

Java Complete Reference