Fixed: MemoryDataSource does not ever end .

When reading data from a DataSource, test the return value is -1 to
determine end of stream.
But MemoryDataSourceImpl is return 0 at last, not return -1.