| 324 | } |
| 325 | |
| 326 | @ApiStatus.Internal |
| 327 | public static void _validateResult(int result) { |
| 328 | switch (result) { |
| 329 | case 1: // kIncompleteInput |
| 330 | throw new IllegalArgumentException("Incomplete input: A partial image was generated."); |
| 331 | |
| 332 | case 2: // kErrorInInput |
| 333 | throw new IllegalArgumentException("Error in input"); |
| 334 | |
| 335 | case 3: // kInvalidConversion |
| 336 | throw new IllegalArgumentException("Invalid conversion: The generator cannot convert to match the request, ignoring dimensions"); |
| 337 | |
| 338 | case 4: // kInvalidScale |
| 339 | throw new IllegalArgumentException("Invalid scale: The generator cannot scale to requested size"); |
| 340 | |
| 341 | case 5: // kInvalidParameters |
| 342 | throw new IllegalArgumentException("Invalid parameter: Parameters (besides info) are invalid. e.g. NULL pixels, rowBytes too small, etc"); |
| 343 | |
| 344 | case 6: // kInvalidInput |
| 345 | throw new IllegalArgumentException("Invalid input: The input did not contain a valid image"); |
| 346 | |
| 347 | case 7: // kCouldNotRewind |
| 348 | throw new UnsupportedOperationException("Could not rewind: Fulfilling this request requires rewinding the input, which is not supported for this input"); |
| 349 | |
| 350 | case 8: // kInternalError |
| 351 | throw new RuntimeException("Internal error"); |
| 352 | |
| 353 | case 9: // kUnimplemented |
| 354 | throw new UnsupportedOperationException("Unimplemented: This method is not implemented by this codec"); |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | @ApiStatus.Internal |
| 359 | public static class _FinalizerHolder { |