Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
NotAssetMemStream Class Reference

#include <FakeStreams.h>

Inheritance diagram for NotAssetMemStream:
SkStream NonseekableStream

Public Member Functions

 NotAssetMemStream (sk_sp< SkData > data)
 
bool hasPosition () const override
 
bool hasLength () const override
 
size_t peek (void *buf, size_t bytes) const override
 
size_t read (void *buf, size_t bytes) override
 
bool rewind () override
 
bool isAtEnd () const override
 
- 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< SkStreamduplicate () const
 
std::unique_ptr< SkStreamfork () 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< SkDatagetData () const
 

Additional Inherited Members

- Static Public Member Functions inherited from SkStream
static std::unique_ptr< SkStreamAssetMakeFromFile (const char path[])
 

Detailed Description

Definition at line 15 of file FakeStreams.h.

Constructor & Destructor Documentation

◆ NotAssetMemStream()

NotAssetMemStream::NotAssetMemStream ( sk_sp< SkData data)
inline

Definition at line 17 of file FakeStreams.h.

17: fStream(std::move(data)) {}
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

Member Function Documentation

◆ hasLength()

bool NotAssetMemStream::hasLength ( ) const
inlineoverridevirtual

Returns true if this stream can report its total length.

Reimplemented from SkStream.

Definition at line 23 of file FakeStreams.h.

23 {
24 return false;
25 }

◆ hasPosition()

bool NotAssetMemStream::hasPosition ( ) const
inlineoverridevirtual

Returns true if this stream can report its current position.

Reimplemented from SkStream.

Definition at line 19 of file FakeStreams.h.

19 {
20 return false;
21 }

◆ isAtEnd()

bool NotAssetMemStream::isAtEnd ( ) const
inlineoverridevirtual

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 36 of file FakeStreams.h.

36 {
37 return fStream.isAtEnd();
38 }
bool isAtEnd() const override
Definition: SkStream.cpp:361

◆ peek()

size_t NotAssetMemStream::peek ( void *  ,
size_t   
) const
inlineoverridevirtual

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.

Parameters
bufferMust not be NULL, and must be at least size bytes. Destination to copy bytes.
sizeNumber of bytes to copy.
Returns
The number of bytes peeked/copied.

Reimplemented from SkStream.

Definition at line 27 of file FakeStreams.h.

27 {
28 return fStream.peek(buf, bytes);
29 }
size_t peek(void *buffer, size_t size) const override
Definition: SkStream.cpp:351

◆ read()

size_t NotAssetMemStream::read ( void *  buffer,
size_t  size 
)
inlineoverridevirtual

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.

Parameters
bufferwhen NULL skip size bytes, otherwise copy size bytes into buffer
sizethe number of bytes to skip or copy
Returns
the number of bytes actually read.

Implements SkStream.

Definition at line 30 of file FakeStreams.h.

30 {
31 return fStream.read(buf, bytes);
32 }
size_t read(void *buffer, size_t size) override
Definition: SkStream.cpp:337

◆ rewind()

bool NotAssetMemStream::rewind ( )
inlineoverridevirtual

Rewinds to the beginning of the stream. Returns true if the stream is known to be at the beginning after this call returns.

Reimplemented from SkStream.

Reimplemented in NonseekableStream.

Definition at line 33 of file FakeStreams.h.

33 {
34 return fStream.rewind();
35 }
bool rewind() override
Definition: SkStream.cpp:365

The documentation for this class was generated from the following file: