added possibility to work with input stream (for server applications, when we do not have files)