added raw datainputstream code from ensirius.