added streamLength method.