| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   58  |   58  | 
|   59     /** Skip size number of bytes. |   59     /** Skip size number of bytes. | 
|   60      *  @return the actual number bytes that could be skipped. |   60      *  @return the actual number bytes that could be skipped. | 
|   61      */ |   61      */ | 
|   62     size_t skip(size_t size) { |   62     size_t skip(size_t size) { | 
|   63         return this->read(NULL, size); |   63         return this->read(NULL, size); | 
|   64     } |   64     } | 
|   65  |   65  | 
|   66     /** |   66     /** | 
|   67      *  Attempt to peek at size bytes. |   67      *  Attempt to peek at size bytes. | 
|   68      *  If this stream supports peeking, and it can peek size bytes, copy size |   68      *  If this stream supports peeking, copy min(size, peekable bytes) into | 
|   69      *  bytes into buffer, and return true. |   69      *  buffer, and return the number of bytes copied. | 
|   70      *  If the stream does not support peeking, or cannot peek size bytes, |   70      *  If the stream does not support peeking, or cannot peek any bytes, | 
|   71      *  return false and leave buffer unchanged. |   71      *  return 0 and leave buffer unchanged. | 
|   72      *  The stream is guaranteed to be in the same visible state after this |   72      *  The stream is guaranteed to be in the same visible state after this | 
|   73      *  call, regardless of success or failure. |   73      *  call, regardless of success or failure. | 
|   74      *  @param buffer Must not be NULL. Destination to copy bytes. |   74      *  @param buffer Must not be NULL, and must be at least size bytes. Destina
     tion | 
 |   75      *      to copy bytes. | 
|   75      *  @param size Number of bytes to copy. |   76      *  @param size Number of bytes to copy. | 
|   76      *  @return Whether the peek was performed. |   77      *  @return The number of bytes peeked/copied. | 
|   77      */ |   78      */ | 
|   78     virtual bool peek(void* /* buffer */, size_t /* size */) const { return fals
     e; } |   79     virtual size_t peek(void* /*buffer*/, size_t /*size*/) const { return 0; } | 
|   79  |   80  | 
|   80     /** Returns true when all the bytes in the stream have been read. |   81     /** Returns true when all the bytes in the stream have been read. | 
|   81      *  This may return true early (when there are no more bytes to be read) |   82      *  This may return true early (when there are no more bytes to be read) | 
|   82      *  or late (after the first unsuccessful read). |   83      *  or late (after the first unsuccessful read). | 
|   83      */ |   84      */ | 
|   84     virtual bool isAtEnd() const = 0; |   85     virtual bool isAtEnd() const = 0; | 
|   85  |   86  | 
|   86     int8_t   readS8(); |   87     int8_t   readS8(); | 
|   87     int16_t  readS16(); |   88     int16_t  readS16(); | 
|   88     int32_t  readS32(); |   89     int32_t  readS32(); | 
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  318      *  The function returns the data parameter as a convenience. |  319      *  The function returns the data parameter as a convenience. | 
|  319      */ |  320      */ | 
|  320     SkData* setData(SkData*); |  321     SkData* setData(SkData*); | 
|  321  |  322  | 
|  322     void skipToAlign4(); |  323     void skipToAlign4(); | 
|  323     const void* getAtPos(); |  324     const void* getAtPos(); | 
|  324  |  325  | 
|  325     size_t read(void* buffer, size_t size) override; |  326     size_t read(void* buffer, size_t size) override; | 
|  326     bool isAtEnd() const override; |  327     bool isAtEnd() const override; | 
|  327  |  328  | 
|  328     bool peek(void* buffer, size_t size) const override; |  329     size_t peek(void* buffer, size_t size) const override; | 
|  329  |  330  | 
|  330     bool rewind() override; |  331     bool rewind() override; | 
|  331     SkMemoryStream* duplicate() const override; |  332     SkMemoryStream* duplicate() const override; | 
|  332  |  333  | 
|  333     size_t getPosition() const override; |  334     size_t getPosition() const override; | 
|  334     bool seek(size_t position) override; |  335     bool seek(size_t position) override; | 
|  335     bool move(long offset) override; |  336     bool move(long offset) override; | 
|  336     SkMemoryStream* fork() const override; |  337     SkMemoryStream* fork() const override; | 
|  337  |  338  | 
|  338     size_t getLength() const override; |  339     size_t getLength() const override; | 
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  438  |  439  | 
|  439 private: |  440 private: | 
|  440     size_t fBytesWritten; |  441     size_t fBytesWritten; | 
|  441     typedef SkWStream INHERITED; |  442     typedef SkWStream INHERITED; | 
|  442 }; |  443 }; | 
|  443  |  444  | 
|  444 // for now |  445 // for now | 
|  445 typedef SkFILEStream SkURLStream; |  446 typedef SkFILEStream SkURLStream; | 
|  446  |  447  | 
|  447 #endif |  448 #endif | 
| OLD | NEW |