xp-framework/rfc — Issue #88: Streams API 
Author: thekid
Created: 2011-10-17 15:52:55+00:00
State: closed
Labels: framework, implemented

Scope of Change
====
A new streams API will be created.

Rationale
====
Add generic, reusable stream interfaces.

Functionality
====

Basics
----
These new interfaces will be created (pseudo-code follows):

```php

```

The io.Stream class will implement all of these interfaces.

Changes: Imaging API
----
* The img.io.StreamWriter class will accept an io.streams.OutputStream
* The img.io.StreamReader class will accept an io.streams.InputStream

Changes: Text API
----
* The text.CSVGenerator class will accept an io.streams.OutputStream
* The text.parser.CSVParser class will accept an io.streams.InputStream

Changes: Remote API
----
* The remote.protocol.ByteCountedString class' writeTo() method
will accept an io.streams.OutputStream
* The remote.protocol.ByteCountedString class' readRrom() method
will accept an io.streams.InputStream

Changes: Peer API
----
* The peer.ldap.util.LDIFWriter class will accept an io.streams.OutputStream

Enhancement: Scriptlet API
----
* The HttpScriptletResponse class will implement the io.streams.OutputStream
interface

Enhancement: I/O Collections API
----
* The io.collections.IOElement interface will receive two new methods:
asInputStream()
asOutputStream()
to support modifying the elements.

Security considerations
====
n/a

Speed impact
====
Slightly slower.

Dependencies
====
None. All changes are BC-break free.

Related documents
====
- InputStream, OutputStream in Java:
http://java.sun.com/j2se/1.5.0/docs/api/java/io/InputStream.html
http://java.sun.com/j2se/1.5.0/docs/api/java/io/OutputStream.html

- Stream in C#:
http://msdn2.microsoft.com/en-us/library/system.io.stream(VS.80).aspx
http://dotgnu.org/pnetlib-doc/System/IO/Stream.html