Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LimitedPeekingMemStream Class Reference
Inheritance diagram for LimitedPeekingMemStream:
SkStream

Public Member Functions

 LimitedPeekingMemStream (sk_sp< SkData > data, size_t limit)
 
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 ()
 
size_t skip (size_t size)
 
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 *)
 
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 905 of file CodecTest.cpp.

Constructor & Destructor Documentation

◆ LimitedPeekingMemStream()

LimitedPeekingMemStream::LimitedPeekingMemStream ( sk_sp< SkData data,
size_t  limit 
)
inline

Definition at line 907 of file CodecTest.cpp.

908 : fStream(std::move(data))
909 , fLimit(limit) {}

Member Function Documentation

◆ isAtEnd()

bool LimitedPeekingMemStream::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 920 of file CodecTest.cpp.

920 {
921 return fStream.isAtEnd();
922 }
bool isAtEnd() const override
Definition SkStream.cpp:361

◆ peek()

size_t LimitedPeekingMemStream::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 911 of file CodecTest.cpp.

911 {
912 return fStream.peek(buf, std::min(bytes, fLimit));
913 }
size_t peek(void *buffer, size_t size) const override
Definition SkStream.cpp:351

◆ read()

size_t LimitedPeekingMemStream::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 914 of file CodecTest.cpp.

914 {
915 return fStream.read(buf, bytes);
916 }
size_t read(void *buffer, size_t size) override
Definition SkStream.cpp:337

◆ rewind()

bool LimitedPeekingMemStream::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.

Definition at line 917 of file CodecTest.cpp.

917 {
918 return fStream.rewind();
919 }
bool rewind() override
Definition SkStream.cpp:365

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