$this->outputStream($outStream);
} // END - if
}
+
+ /**
+ * 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]
// Remember last read line for avoiding possible infinite loops
$lastBuffer = $inputBuffer;
- }
+ } // END - while
// Close directory handle
$fileInstance->closeFile();
if (count($header) != 4) {
// Throw an exception
throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
- }
+ } // END - if
} elseif (substr($rawLine, 0, 5) == $this->dataBlock) {
// Is a data line!
$data = explode($this->seperator, $rawLine);
if (md5($data[0]) != $data[1]) {
// MD5 hash did not match!
throw new InvalidMD5ChecksumException(array($this, md5($data[0]), $data[1]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH);
- }
+ } // END - if
} else {
// Invalid count!
throw new InvalidArrayCountException(array($this, "data", count($data), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
// Other raw lines than header/data tagged lines and re-add the new-line char
$readData .= $rawLine . "\n";
}
- }
+ } // END - foreach
// Was raw lines read and no header/data?
if ((!empty($readData)) && (count($header) == 0) && (count($data) == 0)) {
// Return raw lines back
return $readData;
- }
+ } // END - if
// Was a header found?
if (count($header) != 4) {
// Throw an exception
throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
- }
+ } // END - if
// Decode all from Base64
$readData = @base64_decode($readData);
if (strlen($readData) != $header[2]) {
// Size did not match
throw new InvalidDataLengthException(array($this, strlen($readData), $header[2]), self::EXCEPTION_UNEXPECTED_STRING_SIZE);
- }
+ } // END - if
// Validate the decoded data with the final MD5 hash
if (md5($readData) != $header[3]) {
// MD5 hash did not match!
throw new InvalidMD5ChecksumException(array($this, md5($readData), $header[3]), self::EXCEPTION_MD5_CHECKSUMS_MISMATCH);
- }
+ } // END - if
// Return all in an array
return array(
'data' => $readData
);
}
+
+ /**
+ * 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]