Add a method to read a stream without advancing it.
authorscroggo <scroggo@google.com>
Thu, 2 Apr 2015 20:19:51 +0000 (13:19 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 2 Apr 2015 20:19:51 +0000 (13:19 -0700)
commit028a4135aa6404ccd3a494813befe6e1a35e5e6c
treec8fcabf479a597c8117fcad7a6a506d11beed9bd
parentf92ace90d89cc99b34162dda26be564e34ca80ef
Add a method to read a stream without advancing it.

Add a virtual method on SkStream which will do a "peek" some bytes, so
that those bytes are read, but the next call to read will be
unaffected.

Implement peek for SkMemoryStream, where the implementation is simple
and obvious.

Implement peek on SkFrontBufferedStream.

Add tests.

Motivated by decoding streams which cannot be rewound.

TBR=reed@google.com

BUG=skia:3257

Review URL: https://codereview.chromium.org/1044953002
include/core/SkStream.h
src/core/SkStream.cpp
src/utils/SkFrontBufferedStream.cpp
tests/StreamTest.cpp