Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkStreamPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkStreamPriv_DEFINED
9#define SkStreamPriv_DEFINED
10
13
14class SkData;
15
16/**
17 * Copy the provided stream to an SkData variable.
18 *
19 * Note: Assumes the stream is at the beginning. If it has a length,
20 * but is not at the beginning, this call will fail (return NULL).
21 *
22 * @param stream SkStream to be copied into data.
23 * @return The resulting SkData after the copy, nullptr on failure.
24 */
26
27/**
28 * Copies the input stream from the current position to the end.
29 * Does not rewind the input stream.
30 */
31bool SkStreamCopy(SkWStream* out, SkStream* input);
32
33/** A SkWStream that writes all output to SkDebugf, for debugging purposes. */
34class SkDebugfStream final : public SkWStream {
35public:
36 bool write(const void* buffer, size_t size) override;
37 size_t bytesWritten() const override;
38
39private:
40 size_t fBytesWritten = 0;
41};
42
43// If the stream supports identifying the current position and total length, this returns
44// true if there are not enough bytes in the stream to fulfill a read of the given length.
45// Otherwise, it returns false.
46// False does *not* mean a read will succeed of the given length, but true means we are
47// certain it will fail.
48bool StreamRemainingLengthIsBelow(SkStream* stream, size_t len);
49
50#endif // SkStreamPriv_DEFINED
bool StreamRemainingLengthIsBelow(SkStream *stream, size_t len)
Definition SkStream.cpp:976
bool SkStreamCopy(SkWStream *out, SkStream *input)
Definition SkStream.cpp:954
sk_sp< SkData > SkCopyStreamToData(SkStream *stream)
Definition SkStream.cpp:937
size_t bytesWritten() const override
Definition SkStream.cpp:904
bool write(const void *buffer, size_t size) override
Definition SkStream.cpp:898
static const uint8_t buffer[]