improved reading InputStream to byte array, in case when we read not from file, but from a stream with unknown size