Flutter Engine
The Flutter Engine
|
#include <SkStream.h>
Public Member Functions | |
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< SkStreamAsset > | MakeFromFile (const char path[]) |
Private Member Functions | |
virtual SkStream * | onDuplicate () const |
virtual SkStream * | onFork () const |
SkStream – abstraction for a source of bytes. Subclasses can be backed by memory, or a file, or something else.
Definition at line 29 of file SkStream.h.
|
inlinevirtual |
Definition at line 31 of file SkStream.h.
|
inline |
Definition at line 32 of file SkStream.h.
|
inline |
Duplicates this stream. If this cannot be done, returns NULL. The returned stream will be positioned at the beginning of its data.
Definition at line 105 of file SkStream.h.
|
inline |
Duplicates this stream. If this cannot be done, returns NULL. The returned stream will be positioned the same as this stream.
Definition at line 111 of file SkStream.h.
|
inlinevirtual |
Returns the total length of the stream. If this cannot be done, returns 0.
Reimplemented in SkFILEStream, SkMemoryStream, SkBlockMemoryStream, SkDWriteFontFileStream, HaltingStream, and SkStreamAsset.
Definition at line 137 of file SkStream.h.
|
inlinevirtual |
Returns the starting address for the data. If this cannot be done, returns NULL.
Reimplemented in SkMemoryStream, SkBlockMemoryStream, SkDWriteFontFileStream, and SkStreamMemory.
Definition at line 141 of file SkStream.h.
|
inlinevirtual |
Returns the current position in the stream. If this cannot be done, returns 0.
Reimplemented in SkFILEStream, SkMemoryStream, SkBlockMemoryStream, SkDWriteFontFileStream, HaltingStream, and SkStreamSeekable.
Definition at line 119 of file SkStream.h.
|
inlinevirtual |
Returns true if this stream can report its total length.
Reimplemented in SkStreamAsset, NotAssetMemStream, and HaltingStream.
Definition at line 135 of file SkStream.h.
|
inlinevirtual |
Returns true if this stream can report its current position.
Reimplemented in SkStreamSeekable, NotAssetMemStream, and HaltingStream.
Definition at line 117 of file SkStream.h.
|
pure virtual |
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).
Implemented in SkFILEStream, SkMemoryStream, SkBlockMemoryStream, SkDWriteFontFileStream, LimitedPeekingMemStream, LimitedRewindingStream, NotAssetMemStream, and HaltingStream.
|
static |
Attempts to open the specified file as a stream, returns nullptr on failure.
Definition at line 922 of file SkStream.cpp.
|
inlinevirtual |
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).
Reimplemented in SkFILEStream, SkMemoryStream, SkBlockMemoryStream, SkDWriteFontFileStream, HaltingStream, and SkStreamSeekable.
Definition at line 131 of file SkStream.h.
|
inlineprivatevirtual |
Reimplemented in SkBlockMemoryStream, SkStreamRewindable, SkStreamSeekable, SkStreamAsset, and SkStreamMemory.
Definition at line 145 of file SkStream.h.
|
inlineprivatevirtual |
Reimplemented in SkBlockMemoryStream, SkStreamSeekable, SkStreamAsset, and SkStreamMemory.
Definition at line 146 of file SkStream.h.
|
inlinevirtual |
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 in LimitedPeekingMemStream, NotAssetMemStream, SkBlockMemoryStream, and SkMemoryStream.
Definition at line 68 of file SkStream.h.
|
pure virtual |
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 |
Implemented in LimitedPeekingMemStream, NotAssetMemStream, SkBlockMemoryStream, SkFILEStream, SkMemoryStream, SkDWriteFontFileStream, LimitedRewindingStream, and HaltingStream.
|
inline |
Definition at line 87 of file SkStream.h.
bool SkStream::readPackedUInt | ( | size_t * | i | ) |
Definition at line 52 of file SkStream.cpp.
bool SkStream::readS16 | ( | int16_t * | i | ) |
Definition at line 36 of file SkStream.cpp.
bool SkStream::readS32 | ( | int32_t * | i | ) |
Definition at line 40 of file SkStream.cpp.
bool SkStream::readS8 | ( | int8_t * | i | ) |
Definition at line 32 of file SkStream.cpp.
bool SkStream::readScalar | ( | SkScalar * | i | ) |
Definition at line 44 of file SkStream.cpp.
|
inline |
Definition at line 84 of file SkStream.h.
|
inline |
Definition at line 85 of file SkStream.h.
|
inline |
Definition at line 83 of file SkStream.h.
|
inlinevirtual |
Rewinds to the beginning of the stream. Returns true if the stream is known to be at the beginning after this call returns.
Reimplemented in SkFILEStream, SkMemoryStream, SkBlockMemoryStream, SkDWriteFontFileStream, LimitedPeekingMemStream, LimitedRewindingStream, NotAssetMemStream, NonseekableStream, HaltingStream, and SkStreamRewindable.
Definition at line 100 of file SkStream.h.
|
inlinevirtual |
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.
Reimplemented in SkFILEStream, SkMemoryStream, SkBlockMemoryStream, SkDWriteFontFileStream, HaltingStream, SkStreamSeekable, and NonseekableStream.
Definition at line 125 of file SkStream.h.
|
inline |
Skip size number of bytes.
Definition at line 51 of file SkStream.h.