I/O - Stream

Card Puncher Data Processing

About

A stream concept at the io level is a file (generally a text file)

A stream is an abstract concept for files and io devices which can be read or written, or sometimes both.

I/O devices can be interpreted as streams, as they produce or consume potentially unlimited data over time.

Stream I/O (input/output) refers to the transfer of data either to or from a storage medium. Streams are a mean to manipulate the data that is read or written from and to a file (from byte to characters, object ,…).

For instance, a file content is an ordered collection of bytes and you manipulate this sequence of byte through the creation of a stream that gives you methods to read from and write to and from destinations such as:

When you work with a file system, you work with a path (directory or file)

Note:

Asynchronous

Reading or writing a large amount of data can be resource-intensive. You should perform these tasks asynchronously if your application needs to remain responsive to the user. With synchronous I/O operations, the thread is blocked until the resource-intensive operation has completed. Use asynchronous I/O operations when developing apps to prevent creating the impression that your app has stopped working.

Stream

Data source and destination

A stream can represent many different kinds of:

  • sources
  • and destinations

that holds, generates, or consumes data.

For instance:

  • disk files,
  • another program,
  • a peripheral device,
  • or an (memory)array.

Data Type

Typically, streams are designed for simple byte input and output but they can supports many different kinds of data including:

  • primitive data types,
  • localized characters,
  • and objects.

Transformation

Some streams simply pass on data; others manipulate and transform the data.

Model

All streams present the same simple model to programs that use them.

Input

A program uses an input stream to read data sequentially (one item at time) from a source.

Io Input Stream

Output

A program uses an output stream to write data sequentially (one item at time) to a destination.

Type

Standard

See IO - Standard streams (stdin, stdout, stderr)

Implementation

  • Several languages, such as Perl and Python, implement streams as iterators.
  • Alternative implementations of stream include data-driven languages, such as AWK and sed.

Documentation / Reference





Discover More
Data System Architecture
Characters - EOF (End of File)

EOF is a symbolic name and represents the end of: a file of an input sequence The null terminator '\0' may also be used as “end of file” marker. Type: Ctrl+D (^D) on unix - ...
Imperative Vs Functional
Functional Programming - Reduce - Reduction Operation (fold)

A (reduction|reduce) operation (also called a fold) is a functional programming function. Reduction operations are terminal operations. They takes a sequence of input elements and returns: a single...
Card Puncher Data Processing
I/O - (Input/Output|Read/Write) - Data Access

I/O devices can be interpreted as streams, as they produce or consume potentially unlimited data over time. IO = Input / Output = Writing and Reading data. It's an umbrella term that regroups IO transfer...
Card Puncher Data Processing
IO - Standard streams (stdin, stdout, stderr)

Standard Streams are the mechanism by which a process: receive data (stdin) and output data (stdout, stderr). In a shell, by default, they will: read input from the keyboard and write output...
Card Puncher Data Processing
IO - Vectored operations (scatter/gather)

In computing, vectored I/O, also known as scatter/gather I/O, is a method of input and output by which a single procedure-call sequentially: writes data from multiple buffers to a single data stream...
Java Fileiomethods
Java - IO - Connection (Stream and Channel)

in Java. In order to perform I/O operations (for example reading or writing), you need to perform a connection. In Java, this connection are modelled through: a stream (java.io package) or a channel...
A Synchronous Read
Oracle Database - DISK_ASYNCH_IO parameter

For optimum performance make sure you use asynchronous I/Os. asynchronous stream TRUE is the default parameter value for the majority of platforms. These parameters enable or disable the operating...
Merge Sort
Ordinal Data - Merge sort Algorithm

John von Neumann invented merge sort in 1945. It requires O(n log n) comparisons. A sorting algorithm for rearranging lists (or any other data structure that can only be accessed sequentially, e.g. file...
Data System Architecture
SQL - LOB (large object)

The term large object (LOB) refers to a data item that is too large to be stored directly in a database table. Instead, a pointer is stored in the database table, which points to the location of the...
Card Puncher Data Processing
Shell Data Processing - Stream

This page is the creation of Stream in the Shell context. You start a stream with an initialization function that creates a standard output such as: grep ... You connect then: the first...



Share this page:
Follow us:
Task Runner