Class ImageTooLargeException

All Implemented Interfaces:
Serializable

public class ImageTooLargeException extends ImageValidationException
Image Too Large Exception 图片过大异常

Exception thrown when image dimensions or file size exceed limits.

当图片尺寸或文件大小超出限制时抛出的异常。

Features | 主要功能:

  • Exception for images exceeding size limits - 图片超出大小限制的异常
  • Carries ImageErrorCode for programmatic error handling - 携带 ImageErrorCode 用于编程式错误处理

Usage Examples | 使用示例:

// Catch specific exception
try {
    OpenImage.read(path);
} catch (ImageTooLargeException e) {
    System.err.println(e.getMessage());
}

Security | 安全性:

  • Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
  • Null-safe: No (message must not be null) - 空值安全: 否(消息不能为 null)
Since:
JDK 25, opencode-base-image V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • ImageTooLargeException

      public ImageTooLargeException(int width, int height, int maxWidth, int maxHeight)
      Create an image too large exception for dimensions 创建尺寸过大的图片异常
      Parameters:
      width - actual width | 实际宽度
      height - actual height | 实际高度
      maxWidth - maximum width | 最大宽度
      maxHeight - maximum height | 最大高度
    • ImageTooLargeException

      public ImageTooLargeException(long fileSize, long maxFileSize)
      Create an image too large exception for file size 创建文件过大的图片异常
      Parameters:
      fileSize - actual file size | 实际文件大小
      maxFileSize - maximum file size | 最大文件大小
    • ImageTooLargeException

      public ImageTooLargeException(String message)
      Create an image too large exception with message 创建带消息的图片过大异常
      Parameters:
      message - the error message | 错误消息
  • Method Details

    • getWidth

      public int getWidth()
      Get actual width 获取实际宽度
      Returns:
      the width | 宽度
    • getHeight

      public int getHeight()
      Get actual height 获取实际高度
      Returns:
      the height | 高度
    • getMaxWidth

      public int getMaxWidth()
      Get maximum width 获取最大宽度
      Returns:
      the max width | 最大宽度
    • getMaxHeight

      public int getMaxHeight()
      Get maximum height 获取最大高度
      Returns:
      the max height | 最大高度
    • getFileSize

      public long getFileSize()
      Get actual file size 获取实际文件大小
      Returns:
      the file size | 文件大小
    • getMaxFileSize

      public long getMaxFileSize()
      Get maximum file size 获取最大文件大小
      Returns:
      the max file size | 最大文件大小