![]() |
Skia
2D Graphics Library
|
A stream that wraps a C FILE* file stream. More...
#include <SkStream.h>
Public Member Functions | |
SkFILEStream (const char path[]=nullptr) | |
Initialize the stream by calling sk_fopen on the specified path. More... | |
SkFILEStream (FILE *file) | |
Initialize the stream with an existing C FILE stream. More... | |
SkFILEStream (FILE *file, size_t size) | |
Initialize the stream with an existing C FILE stream. More... | |
~SkFILEStream () override | |
bool | isValid () const |
Returns true if the current path could be opened. More... | |
void | close () |
Close this SkFILEStream. More... | |
size_t | read (void *buffer, size_t size) override |
Reads or skips size number of bytes. More... | |
bool | isAtEnd () const override |
Returns true when all the bytes in the stream have been read. More... | |
bool | rewind () override |
Rewinds to the beginning of the stream. More... | |
std::unique_ptr< SkStreamAsset > | duplicate () const |
size_t | getPosition () const override |
Returns the current position in the stream. More... | |
bool | seek (size_t position) override |
Seeks to an absolute position in the stream. More... | |
bool | move (long offset) override |
Seeks to an relative offset in the stream. More... | |
std::unique_ptr< SkStreamAsset > | fork () const |
size_t | getLength () const override |
Returns the total length of the stream. More... | |
bool | hasLength () const override |
Returns true if this stream can report it's total length. More... | |
bool | hasPosition () const override |
Returns true if this stream can report it's current position. More... | |
size_t | skip (size_t size) |
Skip size number of bytes. More... | |
virtual size_t | peek (void *, size_t) const |
Attempt to peek at size bytes. More... | |
bool SK_WARN_UNUSED_RESULT | readS8 (int8_t *) |
bool SK_WARN_UNUSED_RESULT | readS16 (int16_t *) |
bool SK_WARN_UNUSED_RESULT | readS32 (int32_t *) |
bool SK_WARN_UNUSED_RESULT | readU8 (uint8_t *i) |
bool SK_WARN_UNUSED_RESULT | readU16 (uint16_t *i) |
bool SK_WARN_UNUSED_RESULT | readU32 (uint32_t *i) |
bool SK_WARN_UNUSED_RESULT | readBool (bool *b) |
bool SK_WARN_UNUSED_RESULT | readScalar (SkScalar *) |
bool SK_WARN_UNUSED_RESULT | readPackedUInt (size_t *) |
virtual const void * | getMemoryBase () |
Returns the starting address for the data. More... | |
Static Public Member Functions | |
static std::unique_ptr< SkFILEStream > | Make (const char path[]) |
static std::unique_ptr< SkStreamAsset > | MakeFromFile (const char path[]) |
Attempts to open the specified file as a stream, returns nullptr on failure. More... | |
A stream that wraps a C FILE* file stream.
|
explicit |
Initialize the stream by calling sk_fopen on the specified path.
This internal stream will be closed in the destructor.
|
explicit |
Initialize the stream with an existing C FILE stream.
The current position of the C FILE stream will be considered the beginning of the SkFILEStream and the current seek end of the FILE will be the end. The C FILE stream will be closed in the destructor.
|
explicit |
Initialize the stream with an existing C FILE stream.
The current position of the C FILE stream will be considered the beginning of the SkFILEStream and size bytes later will be the end. The C FILE stream will be closed in the destructor.
|
override |
void SkFILEStream::close | ( | ) |
Close this SkFILEStream.
|
inline |
|
inline |
|
overridevirtual |
Returns the total length of the stream.
If this cannot be done, returns 0.
Implements SkStreamAsset.
|
inlinevirtualinherited |
Returns the starting address for the data.
If this cannot be done, returns NULL.
Reimplemented in SkStreamMemory, and SkMemoryStream.
|
overridevirtual |
Returns the current position in the stream.
If this cannot be done, returns 0.
Implements SkStreamSeekable.
|
inlineoverridevirtualinherited |
Returns true if this stream can report it's total length.
Reimplemented from SkStream.
|
inlineoverridevirtualinherited |
Returns true if this stream can report it's current position.
Reimplemented from SkStream.
|
overridevirtual |
Returns true when all the bytes in the stream 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.
|
inline |
Returns true if the current path could be opened.
|
inlinestatic |
|
staticinherited |
Attempts to open the specified file as a stream, returns nullptr on failure.
|
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.
|
inlinevirtualinherited |
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 SkMemoryStream.
|
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.
|
inlineinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
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.
|
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.
|
inlineinherited |
Skip size number of bytes.