Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkStream_DEFINED | 8 #ifndef SkStream_DEFINED |
| 9 #define SkStream_DEFINED | 9 #define SkStream_DEFINED |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 | 49 |
| 50 /** Reads or skips size number of bytes. | 50 /** Reads or skips size number of bytes. |
| 51 * If buffer == NULL, skip size bytes, return how many were skipped. | 51 * If buffer == NULL, skip size bytes, return how many were skipped. |
| 52 * If buffer != NULL, copy size bytes into buffer, return how many were cop ied. | 52 * If buffer != NULL, copy size bytes into buffer, return how many were cop ied. |
| 53 * @param buffer when NULL skip size bytes, otherwise copy size bytes into buffer | 53 * @param buffer when NULL skip size bytes, otherwise copy size bytes into buffer |
| 54 * @param size the number of bytes to skip or copy | 54 * @param size the number of bytes to skip or copy |
| 55 * @return the number of bytes actually read. | 55 * @return the number of bytes actually read. |
| 56 */ | 56 */ |
| 57 virtual size_t read(void* buffer, size_t size) = 0; | 57 virtual size_t read(void* buffer, size_t size) = 0; |
| 58 | 58 |
| 59 /** | |
| 60 * Attempt to read size bytes into a SkData. If the read success, return th e data, | |
| 61 * else return NULL. Either way the stream's cursor may have been changed a s a result | |
| 62 * of calling read(). | |
| 63 */ | |
| 64 SkData* readIntoData(size_t size); | |
|
bungeman-skia
2014/09/12 14:50:27
Eck, not another thing on SkStream...
It seems li
reed1
2014/09/12 18:55:17
Done.
| |
| 65 | |
| 59 /** Skip size number of bytes. | 66 /** Skip size number of bytes. |
| 60 * @return the actual number bytes that could be skipped. | 67 * @return the actual number bytes that could be skipped. |
| 61 */ | 68 */ |
| 62 size_t skip(size_t size) { | 69 size_t skip(size_t size) { |
| 63 return this->read(NULL, size); | 70 return this->read(NULL, size); |
| 64 } | 71 } |
| 65 | 72 |
| 66 /** Returns true when all the bytes in the stream have been read. | 73 /** Returns true when all the bytes in the stream have been read. |
| 67 * This may return true early (when there are no more bytes to be read) | 74 * This may return true early (when there are no more bytes to be read) |
| 68 * or late (after the first unsuccessful read). | 75 * or late (after the first unsuccessful read). |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 | 463 |
| 457 private: | 464 private: |
| 458 size_t fBytesWritten; | 465 size_t fBytesWritten; |
| 459 typedef SkWStream INHERITED; | 466 typedef SkWStream INHERITED; |
| 460 }; | 467 }; |
| 461 | 468 |
| 462 // for now | 469 // for now |
| 463 typedef SkFILEStream SkURLStream; | 470 typedef SkFILEStream SkURLStream; |
| 464 | 471 |
| 465 #endif | 472 #endif |
| OLD | NEW |