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