Cary Clark | d2ca79c | 2018-08-10 13:09:13 -0400 | [diff] [blame] | 1 | #Topic Stream |
| 2 | #Alias Stream_Reference ## |
| 3 | |
| 4 | #Class SkStream |
| 5 | |
| 6 | SkStream describes an abstract class that provides readable serial access to |
| 7 | data. Subclass SkFILEStream stores readable data in a file. Subclass |
| 8 | SkMemoryStream stores readable data in memory. |
| 9 | |
| 10 | SkStream data is immutable; data access is synchronous. Reading Stream data |
| 11 | returns only as many bytes as were available when Stream was created. Unlike |
| 12 | traditional streams, additional data will not become available at a later time |
| 13 | or on a subsequent read request. |
| 14 | |
| 15 | #Subtopic Overview |
| 16 | #Populate |
| 17 | ## |
| 18 | |
| 19 | #Subtopic Constructor |
| 20 | #Populate |
| 21 | ## |
| 22 | |
| 23 | #Subtopic Member_Function |
| 24 | #Populate |
| 25 | ## |
| 26 | |
| 27 | # ------------------------------------------------------------------------------ |
| 28 | |
| 29 | #Method virtual ~SkStream() |
| 30 | #In Constructor |
| 31 | #Line # incomplete ## |
| 32 | |
| 33 | #Example |
| 34 | // incomplete |
| 35 | ## |
| 36 | |
| 37 | #SeeAlso incomplete |
| 38 | |
| 39 | #Method ## |
| 40 | |
| 41 | # ------------------------------------------------------------------------------ |
| 42 | |
| 43 | #Method SkStream() |
| 44 | #In Constructor |
| 45 | #Line # incomplete ## |
| 46 | |
| 47 | #Return incomplete ## |
| 48 | |
| 49 | #Example |
| 50 | // incomplete |
| 51 | ## |
| 52 | |
| 53 | #SeeAlso incomplete |
| 54 | |
| 55 | #Method ## |
| 56 | |
| 57 | # ------------------------------------------------------------------------------ |
| 58 | |
| 59 | #Method static std::unique_ptr<SkStreamAsset> MakeFromFile(const char path[]) |
| 60 | #In incomplete |
| 61 | #Line # incomplete ## |
| 62 | |
| 63 | Attempts to open the specified file as a stream, returns nullptr on failure. |
| 64 | |
| 65 | #Param path incomplete ## |
| 66 | |
| 67 | #Return incomplete ## |
| 68 | |
| 69 | #Example |
| 70 | // incomplete |
| 71 | ## |
| 72 | |
| 73 | #SeeAlso incomplete |
| 74 | |
| 75 | #Method ## |
| 76 | |
| 77 | # ------------------------------------------------------------------------------ |
| 78 | |
| 79 | #Method virtual size_t read(void* buffer, size_t size) = 0 |
| 80 | #In incomplete |
| 81 | #Line # incomplete ## |
| 82 | |
| 83 | Reads or skips size number of bytes. |
| 84 | If buffer is nullptr, skip size bytes, return how many were skipped. |
| 85 | If buffer is not nullptr, copy size bytes into buffer, return how many were copied. |
| 86 | |
| 87 | #Param buffer when nullptr skip size bytes, otherwise copy size bytes into buffer |
| 88 | ## |
| 89 | #Param size the number of bytes to skip or copy |
| 90 | ## |
| 91 | |
| 92 | #Return the number of bytes actually read. |
| 93 | ## |
| 94 | |
| 95 | #Example |
| 96 | // incomplete |
| 97 | ## |
| 98 | |
| 99 | #SeeAlso incomplete |
| 100 | |
| 101 | #Method ## |
| 102 | |
| 103 | # ------------------------------------------------------------------------------ |
| 104 | |
| 105 | #Method size_t skip(size_t size) |
| 106 | #In incomplete |
| 107 | #Line # incomplete ## |
| 108 | |
| 109 | Skip size number of bytes. #Param size incomplete ## |
| 110 | |
| 111 | #Return the actual number bytes that could be skipped |
| 112 | ## |
| 113 | |
| 114 | #Example |
| 115 | // incomplete |
| 116 | ## |
| 117 | |
| 118 | #SeeAlso incomplete |
| 119 | |
| 120 | #Method ## |
| 121 | |
| 122 | # ------------------------------------------------------------------------------ |
| 123 | |
| 124 | #Method virtual size_t peek(void* buffer, size_t size) const |
| 125 | #In incomplete |
| 126 | #Line # incomplete ## |
| 127 | |
| 128 | Attempt to peek at size bytes. |
| 129 | If this stream supports peeking, copy min(size, peekable bytes) into |
| 130 | buffer, and return the number of bytes copied. |
| 131 | If the stream does not support peeking, or cannot peek any bytes, |
| 132 | return 0 and leave buffer unchanged. |
| 133 | The stream is guaranteed to be in the same visible state after this |
| 134 | call, regardless of success or failure. |
| 135 | |
| 136 | #Param buffer must not be nullptr, and must be at least size bytes. Destination |
| 137 | to copy bytes |
| 138 | ## |
| 139 | #Param size number of bytes to copy |
| 140 | ## |
| 141 | |
| 142 | #Return number of bytes peeked/copied. |
| 143 | ## |
| 144 | |
| 145 | #Example |
| 146 | // incomplete |
| 147 | ## |
| 148 | |
| 149 | #SeeAlso incomplete |
| 150 | |
| 151 | #Method ## |
| 152 | |
| 153 | # ------------------------------------------------------------------------------ |
| 154 | |
| 155 | #Method virtual bool isAtEnd() const = 0 |
| 156 | #In incomplete |
| 157 | #Line # incomplete ## |
| 158 | |
| 159 | Returns true when all the bytes in the stream have been read. |
| 160 | This may return true early (when there are no more bytes to be read) |
| 161 | or late (after the first unsuccessful read). |
| 162 | |
| 163 | #Return incomplete ## |
| 164 | |
| 165 | #Example |
| 166 | // incomplete |
| 167 | ## |
| 168 | |
| 169 | #SeeAlso incomplete |
| 170 | |
| 171 | #Method ## |
| 172 | |
| 173 | # ------------------------------------------------------------------------------ |
| 174 | |
| 175 | #Method bool SK_WARN_UNUSED_RESULT readS8(int8_t* i) |
| 176 | #In incomplete |
| 177 | #Line # incomplete ## |
| 178 | |
| 179 | #Param i incomplete ## |
| 180 | |
| 181 | #Return incomplete ## |
| 182 | |
| 183 | #Example |
| 184 | // incomplete |
| 185 | ## |
| 186 | |
| 187 | #SeeAlso incomplete |
| 188 | |
| 189 | #Method ## |
| 190 | |
| 191 | # ------------------------------------------------------------------------------ |
| 192 | |
| 193 | #Method bool SK_WARN_UNUSED_RESULT readS16(int16_t* i) |
| 194 | #In incomplete |
| 195 | #Line # incomplete ## |
| 196 | |
| 197 | #Param i incomplete ## |
| 198 | |
| 199 | #Return incomplete ## |
| 200 | |
| 201 | #Example |
| 202 | // incomplete |
| 203 | ## |
| 204 | |
| 205 | #SeeAlso incomplete |
| 206 | |
| 207 | #Method ## |
| 208 | |
| 209 | # ------------------------------------------------------------------------------ |
| 210 | |
| 211 | #Method bool SK_WARN_UNUSED_RESULT readS32(int32_t* i) |
| 212 | #In incomplete |
| 213 | #Line # incomplete ## |
| 214 | |
| 215 | #Param i incomplete ## |
| 216 | |
| 217 | #Return incomplete ## |
| 218 | |
| 219 | #Example |
| 220 | // incomplete |
| 221 | ## |
| 222 | |
| 223 | #SeeAlso incomplete |
| 224 | |
| 225 | #Method ## |
| 226 | |
| 227 | # ------------------------------------------------------------------------------ |
| 228 | |
| 229 | #Method bool SK_WARN_UNUSED_RESULT readU8(uint8_t* i) |
| 230 | #In incomplete |
| 231 | #Line # incomplete ## |
| 232 | |
| 233 | #Param i incomplete ## |
| 234 | |
| 235 | #Return incomplete ## |
| 236 | |
| 237 | #Example |
| 238 | // incomplete |
| 239 | ## |
| 240 | |
| 241 | #SeeAlso incomplete |
| 242 | |
| 243 | #Method ## |
| 244 | |
| 245 | # ------------------------------------------------------------------------------ |
| 246 | |
| 247 | #Method bool SK_WARN_UNUSED_RESULT readU16(uint16_t* i) |
| 248 | #In incomplete |
| 249 | #Line # incomplete ## |
| 250 | |
| 251 | #Param i incomplete ## |
| 252 | |
| 253 | #Return incomplete ## |
| 254 | |
| 255 | #Example |
| 256 | // incomplete |
| 257 | ## |
| 258 | |
| 259 | #SeeAlso incomplete |
| 260 | |
| 261 | #Method ## |
| 262 | |
| 263 | # ------------------------------------------------------------------------------ |
| 264 | |
| 265 | #Method bool SK_WARN_UNUSED_RESULT readU32(uint32_t* i) |
| 266 | #In incomplete |
| 267 | #Line # incomplete ## |
| 268 | |
| 269 | #Param i incomplete ## |
| 270 | |
| 271 | #Return incomplete ## |
| 272 | |
| 273 | #Example |
| 274 | // incomplete |
| 275 | ## |
| 276 | |
| 277 | #SeeAlso incomplete |
| 278 | |
| 279 | #Method ## |
| 280 | |
| 281 | # ------------------------------------------------------------------------------ |
| 282 | |
| 283 | #Method bool SK_WARN_UNUSED_RESULT readBool(bool* b) |
| 284 | #In incomplete |
| 285 | #Line # incomplete ## |
| 286 | |
| 287 | #Param b incomplete ## |
| 288 | |
| 289 | #Return incomplete ## |
| 290 | |
| 291 | #Example |
| 292 | // incomplete |
| 293 | ## |
| 294 | |
| 295 | #SeeAlso incomplete |
| 296 | |
| 297 | #Method ## |
| 298 | |
| 299 | # ------------------------------------------------------------------------------ |
| 300 | |
| 301 | #Method bool SK_WARN_UNUSED_RESULT readScalar(SkScalar* s) |
| 302 | #In incomplete |
| 303 | #Line # incomplete ## |
| 304 | |
| 305 | #Param s incomplete ## |
| 306 | |
| 307 | #Return incomplete ## |
| 308 | |
| 309 | #Example |
| 310 | // incomplete |
| 311 | ## |
| 312 | |
| 313 | #SeeAlso incomplete |
| 314 | |
| 315 | #Method ## |
| 316 | |
| 317 | # ------------------------------------------------------------------------------ |
| 318 | |
| 319 | #Method bool SK_WARN_UNUSED_RESULT readPackedUInt(size_t* u) |
| 320 | #In incomplete |
| 321 | #Line # incomplete ## |
| 322 | |
| 323 | #Param u incomplete ## |
| 324 | |
| 325 | #Return incomplete ## |
| 326 | |
| 327 | #Example |
| 328 | // incomplete |
| 329 | ## |
| 330 | |
| 331 | #SeeAlso incomplete |
| 332 | |
| 333 | #Method ## |
| 334 | |
| 335 | # ------------------------------------------------------------------------------ |
| 336 | |
| 337 | #Method virtual bool rewind() |
| 338 | #In incomplete |
| 339 | #Line # incomplete ## |
| 340 | |
| 341 | Rewinds to the beginning of the stream. Returns true if the stream is known |
| 342 | to be at the beginning after this call returns. |
| 343 | |
| 344 | #Return incomplete ## |
| 345 | |
| 346 | #Example |
| 347 | // incomplete |
| 348 | ## |
| 349 | |
| 350 | #SeeAlso incomplete |
| 351 | |
| 352 | #Method ## |
| 353 | |
| 354 | # ------------------------------------------------------------------------------ |
| 355 | |
| 356 | #Method std::unique_ptr<SkStream> duplicate() const |
| 357 | #In incomplete |
| 358 | #Line # incomplete ## |
| 359 | |
| 360 | Duplicates this stream. If this cannot be done, returns NULL. |
| 361 | The returned stream will be positioned at the beginning of its data. |
| 362 | |
| 363 | #Return incomplete ## |
| 364 | |
| 365 | #Example |
| 366 | // incomplete |
| 367 | ## |
| 368 | |
| 369 | #SeeAlso incomplete |
| 370 | |
| 371 | #Method ## |
| 372 | |
| 373 | # ------------------------------------------------------------------------------ |
| 374 | |
| 375 | #Method std::unique_ptr<SkStream> fork() const |
| 376 | #In incomplete |
| 377 | #Line # incomplete ## |
| 378 | |
| 379 | Duplicates this stream. If this cannot be done, returns NULL. |
| 380 | The returned stream will be positioned the same as this stream. |
| 381 | |
| 382 | #Return incomplete ## |
| 383 | |
| 384 | #Example |
| 385 | // incomplete |
| 386 | ## |
| 387 | |
| 388 | #SeeAlso incomplete |
| 389 | |
| 390 | #Method ## |
| 391 | |
| 392 | # ------------------------------------------------------------------------------ |
| 393 | |
| 394 | #Method virtual bool hasPosition() const |
| 395 | #In incomplete |
| 396 | #Line # incomplete ## |
| 397 | |
| 398 | Returns true if this stream can report its current position. |
| 399 | |
| 400 | #Return incomplete ## |
| 401 | |
| 402 | #Example |
| 403 | // incomplete |
| 404 | ## |
| 405 | |
| 406 | #SeeAlso incomplete |
| 407 | |
| 408 | #Method ## |
| 409 | |
| 410 | # ------------------------------------------------------------------------------ |
| 411 | |
| 412 | #Method virtual size_t getPosition() const |
| 413 | #In incomplete |
| 414 | #Line # incomplete ## |
| 415 | |
| 416 | Returns the current position in the stream. If this cannot be done, returns 0. |
| 417 | |
| 418 | #Return incomplete ## |
| 419 | |
| 420 | #Example |
| 421 | // incomplete |
| 422 | ## |
| 423 | |
| 424 | #SeeAlso incomplete |
| 425 | |
| 426 | #Method ## |
| 427 | |
| 428 | # ------------------------------------------------------------------------------ |
| 429 | |
| 430 | #Method virtual bool seek(size_t position) |
| 431 | #In incomplete |
| 432 | #Line # incomplete ## |
| 433 | |
| 434 | #Param position incomplete ## |
| 435 | |
| 436 | Seeks to an absolute position in the stream. If this cannot be done, returns false. |
| 437 | If an attempt is made to seek past the end of the stream, the position will be set |
| 438 | to the end of the stream. |
| 439 | |
| 440 | #Return incomplete ## |
| 441 | |
| 442 | #Example |
| 443 | // incomplete |
| 444 | ## |
| 445 | |
| 446 | #SeeAlso incomplete |
| 447 | |
| 448 | #Method ## |
| 449 | |
| 450 | # ------------------------------------------------------------------------------ |
| 451 | |
| 452 | #Method virtual bool move(long offset) |
| 453 | #In incomplete |
| 454 | #Line # incomplete ## |
| 455 | |
| 456 | #Param offset incomplete ## |
| 457 | |
| 458 | Seeks to an relative offset in the stream. If this cannot be done, returns false. |
| 459 | If an attempt is made to move to a position outside the stream, the position will be set |
| 460 | to the closest point within the stream (beginning or end). |
| 461 | |
| 462 | #Return incomplete ## |
| 463 | |
| 464 | #Example |
| 465 | // incomplete |
| 466 | ## |
| 467 | |
| 468 | #SeeAlso incomplete |
| 469 | |
| 470 | #Method ## |
| 471 | |
| 472 | # ------------------------------------------------------------------------------ |
| 473 | |
| 474 | #Method virtual bool hasLength() const |
| 475 | #In incomplete |
| 476 | #Line # incomplete ## |
| 477 | |
| 478 | Returns true if this stream can report its total length. |
| 479 | |
| 480 | #Return incomplete ## |
| 481 | |
| 482 | #Example |
| 483 | // incomplete |
| 484 | ## |
| 485 | |
| 486 | #SeeAlso incomplete |
| 487 | |
| 488 | #Method ## |
| 489 | |
| 490 | # ------------------------------------------------------------------------------ |
| 491 | |
| 492 | #Method virtual size_t getLength() const |
| 493 | #In incomplete |
| 494 | #Line # incomplete ## |
| 495 | |
| 496 | Returns the total length of the stream. If this cannot be done, returns 0. |
| 497 | |
| 498 | #Return incomplete ## |
| 499 | |
| 500 | #Example |
| 501 | // incomplete |
| 502 | ## |
| 503 | |
| 504 | #SeeAlso incomplete |
| 505 | |
| 506 | #Method ## |
| 507 | |
| 508 | # ------------------------------------------------------------------------------ |
| 509 | |
| 510 | #Method virtual const void* getMemoryBase() |
| 511 | #In incomplete |
| 512 | #Line # incomplete ## |
| 513 | |
| 514 | Returns the starting address for the data. If this cannot be done, returns NULL. |
| 515 | TODO: replace with virtual const SkData* getData() |
| 516 | |
| 517 | #Return incomplete ## |
| 518 | |
| 519 | #Example |
| 520 | // incomplete |
| 521 | ## |
| 522 | |
| 523 | #SeeAlso incomplete |
| 524 | |
| 525 | #Method ## |
| 526 | |
| 527 | #Class SkStream ## |
| 528 | |
| 529 | #Topic Stream ## |