From: Roland Häder Date: Thu, 14 Apr 2011 21:09:20 +0000 (+0000) Subject: Added streamData() method to interface Streamable X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=53d74b6cc03ababd3eec142fa99e92de0ca2be2c Added streamData() method to interface Streamable --- diff --git a/inc/classes/interfaces/streams/class_Streamable.php b/inc/classes/interfaces/streams/class_Streamable.php index b5600168..c0e89f5d 100644 --- a/inc/classes/interfaces/streams/class_Streamable.php +++ b/inc/classes/interfaces/streams/class_Streamable.php @@ -22,6 +22,13 @@ * along with this program. If not, see . */ interface Streamable extends FrameworkInterface { + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + */ + function streamData ($data); } // [EOF] diff --git a/inc/classes/main/streams/class_ b/inc/classes/main/streams/class_ index d556b5ba..fe179d01 100644 --- a/inc/classes/main/streams/class_ +++ b/inc/classes/main/streams/class_ @@ -44,6 +44,18 @@ class ???Stream extends BaseStream implements Streamable { // Return the instance return $streamInstance; } + + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + * @throws UnsupportedOperationException If this method is called + */ + public function streamData ($data) { + $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF] diff --git a/inc/classes/main/streams/crypto/class_McryptStream.php b/inc/classes/main/streams/crypto/class_McryptStream.php index a0fc4b53..829f35bc 100644 --- a/inc/classes/main/streams/crypto/class_McryptStream.php +++ b/inc/classes/main/streams/crypto/class_McryptStream.php @@ -150,6 +150,18 @@ class McryptStream extends BaseStream implements EncryptableStream { // Return the string return $str; } + + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + * @throws UnsupportedOperationException If this method is called (which is a mistake) + */ + public function streamData ($data) { + $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF] diff --git a/inc/classes/main/streams/crypto/class_NullCryptoStream.php b/inc/classes/main/streams/crypto/class_NullCryptoStream.php index bcaab6f0..a8fb9ecd 100644 --- a/inc/classes/main/streams/crypto/class_NullCryptoStream.php +++ b/inc/classes/main/streams/crypto/class_NullCryptoStream.php @@ -73,6 +73,18 @@ class NullCryptoStream extends BaseStream implements EncryptableStream { // Return it return $str; } + + /** + * Streams the data and maybe does something to it + * + * @param $data The data (string mostly) to "stream" + * @return $data The data (string mostly) to "stream" + * @throws UnsupportedOperationException If this method is called (which is a mistake) + */ + public function streamData ($data) { + $this->debugOutput('Unhandled ' . strlen($data) . ' bytes in this stream.'); + throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); + } } // [EOF]