Utility functions for data streams