Flutter Engine
The Flutter Engine
|
#include <SkStream.h>
Public Member Functions | |
SkMemoryStream () | |
SkMemoryStream (size_t length) | |
SkMemoryStream (const void *data, size_t length, bool copyData=false) | |
SkMemoryStream (sk_sp< SkData > data) | |
virtual void | setMemory (const void *data, size_t length, bool copyData=false) |
void | setMemoryOwned (const void *data, size_t length) |
sk_sp< SkData > | getData () const override |
void | setData (sk_sp< SkData > data) |
const void * | getAtPos () |
size_t | read (void *buffer, size_t size) override |
bool | isAtEnd () const override |
size_t | peek (void *buffer, size_t size) const override |
bool | rewind () override |
std::unique_ptr< SkMemoryStream > | duplicate () const |
size_t | getPosition () const override |
bool | seek (size_t position) override |
bool | move (long offset) override |
std::unique_ptr< SkMemoryStream > | fork () const |
size_t | getLength () const override |
const void * | getMemoryBase () override |
Public Member Functions inherited from SkStreamMemory | |
const void * | getMemoryBase () override=0 |
std::unique_ptr< SkStreamMemory > | duplicate () const |
std::unique_ptr< SkStreamMemory > | fork () const |
Public Member Functions inherited from SkStreamAsset | |
bool | hasLength () const override |
size_t | getLength () const override=0 |
std::unique_ptr< SkStreamAsset > | duplicate () const |
std::unique_ptr< SkStreamAsset > | fork () const |
Public Member Functions inherited from SkStreamSeekable | |
std::unique_ptr< SkStreamSeekable > | duplicate () const |
bool | hasPosition () const override |
size_t | getPosition () const override=0 |
bool | seek (size_t position) override=0 |
bool | move (long offset) override=0 |
std::unique_ptr< SkStreamSeekable > | fork () const |
Public Member Functions inherited from SkStreamRewindable | |
bool | rewind () override=0 |
std::unique_ptr< SkStreamRewindable > | duplicate () const |
Public Member Functions inherited from SkStream | |
virtual | ~SkStream () |
SkStream () | |
virtual size_t | read (void *buffer, size_t size)=0 |
size_t | skip (size_t size) |
virtual size_t | peek (void *, size_t) const |
virtual bool | isAtEnd () const =0 |
bool | readS8 (int8_t *) |
bool | readS16 (int16_t *) |
bool | readS32 (int32_t *) |
bool | readU8 (uint8_t *i) |
bool | readU16 (uint16_t *i) |
bool | readU32 (uint32_t *i) |
bool | readBool (bool *b) |
bool | readScalar (SkScalar *) |
bool | readPackedUInt (size_t *) |
virtual bool | rewind () |
std::unique_ptr< SkStream > | duplicate () const |
std::unique_ptr< SkStream > | fork () const |
virtual bool | hasPosition () const |
virtual size_t | getPosition () const |
virtual bool | seek (size_t) |
virtual bool | move (long) |
virtual bool | hasLength () const |
virtual size_t | getLength () const |
virtual const void * | getMemoryBase () |
virtual sk_sp< SkData > | getData () const |
Static Public Member Functions | |
static std::unique_ptr< SkMemoryStream > | MakeCopy (const void *data, size_t length) |
static std::unique_ptr< SkMemoryStream > | MakeDirect (const void *data, size_t length) |
static std::unique_ptr< SkMemoryStream > | Make (sk_sp< SkData > data) |
Static Public Member Functions inherited from SkStream | |
static std::unique_ptr< SkStreamAsset > | MakeFromFile (const char path[]) |
Definition at line 361 of file SkStream.h.
SkMemoryStream::SkMemoryStream | ( | ) |
Definition at line 284 of file SkStream.cpp.
SkMemoryStream::SkMemoryStream | ( | size_t | length | ) |
We allocate (and free) the memory. Write to it via getMemoryBase()
Definition at line 289 of file SkStream.cpp.
SkMemoryStream::SkMemoryStream | ( | const void * | data, |
size_t | length, | ||
bool | copyData = false |
||
) |
If copyData is true, the stream makes a private copy of the data.
Definition at line 294 of file SkStream.cpp.
Creates the stream to read from the specified data
Definition at line 299 of file SkStream.cpp.
|
inline |
Definition at line 407 of file SkStream.h.
|
inline |
Definition at line 415 of file SkStream.h.
const void * SkMemoryStream::getAtPos | ( | ) |
Definition at line 403 of file SkStream.cpp.
|
overridevirtual |
Returns the total length of the stream. If this cannot be done, returns 0.
Implements SkStreamAsset.
Definition at line 395 of file SkStream.cpp.
|
overridevirtual |
Returns the starting address for the data. If this cannot be done, returns NULL.
Implements SkStreamMemory.
Definition at line 399 of file SkStream.cpp.
|
overridevirtual |
Returns the current position in the stream. If this cannot be done, returns 0.
Implements SkStreamSeekable.
Definition at line 374 of file SkStream.cpp.
|
overridevirtual |
Returns true when all the bytes in the stream have been read. As SkStream represents synchronous I/O, isAtEnd returns false when the final stream length isn't known yet, even when all the bytes available so far have been read. This may return true early (when there are no more bytes to be read) or late (after the first unsuccessful read).
Implements SkStream.
Definition at line 361 of file SkStream.cpp.
|
static |
Returns a stream with a shared reference to the input data.
Definition at line 314 of file SkStream.cpp.
|
static |
Returns a stream with a copy of the input data.
Definition at line 306 of file SkStream.cpp.
|
static |
Returns a stream with a bare pointer reference to the input data.
Definition at line 310 of file SkStream.cpp.
|
overridevirtual |
Seeks to an relative offset in the stream. If this cannot be done, returns false. If an attempt is made to move to a position outside the stream, the position will be set to the closest point within the stream (beginning or end).
Implements SkStreamSeekable.
Definition at line 385 of file SkStream.cpp.
|
overridevirtual |
Attempt to peek at size bytes. If this stream supports peeking, copy min(size, peekable bytes) into buffer, and return the number of bytes copied. If the stream does not support peeking, or cannot peek any bytes, return 0 and leave buffer unchanged. The stream is guaranteed to be in the same visible state after this call, regardless of success or failure.
buffer | Must not be NULL, and must be at least size bytes. Destination to copy bytes. |
size | Number of bytes to copy. |
Reimplemented from SkStream.
Definition at line 351 of file SkStream.cpp.
|
overridevirtual |
Reads or skips size number of bytes. If buffer == NULL, skip size bytes, return how many were skipped. If buffer != NULL, copy size bytes into buffer, return how many were copied.
buffer | when NULL skip size bytes, otherwise copy size bytes into buffer |
size | the number of bytes to skip or copy |
Implements SkStream.
Definition at line 337 of file SkStream.cpp.
|
overridevirtual |
Rewinds to the beginning of the stream. Returns true if the stream is known to be at the beginning after this call returns.
Implements SkStreamRewindable.
Definition at line 365 of file SkStream.cpp.
|
overridevirtual |
Seeks to an absolute position in the stream. If this cannot be done, returns false. If an attempt is made to seek past the end of the stream, the position will be set to the end of the stream.
Implements SkStreamSeekable.
Definition at line 378 of file SkStream.cpp.
Definition at line 328 of file SkStream.cpp.
|
virtual |
Resets the stream to the specified data and length, just like the constructor. if copyData is true, the stream makes a private copy of the data
Definition at line 323 of file SkStream.cpp.
void SkMemoryStream::setMemoryOwned | ( | const void * | data, |
size_t | length | ||
) |
Replace any memory buffer with the specified buffer. The caller must have allocated data with sk_malloc or sk_realloc, since it will be freed with sk_free.
Definition at line 318 of file SkStream.cpp.